:root {
  color-scheme: dark;
  --bg: #10110f;
  --panel: #191a17;
  --panel-2: #20221d;
  --panel-3: #262921;
  --text: #f1efe4;
  --muted: #aaa99a;
  --line: #3d4035;
  --gold: #f2c14e;
  --gold-2: #d89435;
  --red: #d55757;
  --green: #66bf8a;
  --blue: #70a6d8;
  --ink: #18130e;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  --radius: 8px;
  --score-font: Constantia, "Palatino Linotype", "Book Antiqua", "Yu Mincho", YuMincho,
    "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
  --cursor-default: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8cGF0aCBkPSJNMyAyLjUgMjQuNSAxNGwtOSAyLjIgNS40IDkuMi01IDIuOS01LjMtOS4zLTYuMiA2LjlaIiBmaWxsPSIjMWExMjA5IiBzdHJva2U9IiMwOTA3MDQiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxwYXRoIGQ9Ik0zLjcgMy41IDIzIDEzLjhsLTguOSAyLjEgNS41IDkuMy0zLjQgMi01LjUtOS41LTUuNSA2LjFaIiBmaWxsPSIjZjJjMTRlIiBzdHJva2U9IiNmZmYwYTgiIHN0cm9rZS13aWR0aD0iMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxwYXRoIGQ9Im03LjIgNy4yIDguMyA2LjEtNC40IDEuMVoiIGZpbGw9IiNmZmY1YzciIG9wYWNpdHk9Ii43MiIvPgo8L3N2Zz4K") 3 3, default;
  --cursor-disabled: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8cGF0aCBkPSJNMyAyLjUgMjQuNSAxNGwtOSAyLjIgNS40IDkuMi01IDIuOS01LjMtOS4zLTYuMiA2LjlaIiBmaWxsPSIjMTcxMjBkIiBzdHJva2U9IiMwODA2MDQiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxwYXRoIGQ9Ik0zLjcgMy41IDIzIDEzLjhsLTguOSAyLjEgNS41IDkuMy0zLjQgMi01LjUtOS41LTUuNSA2LjFaIiBmaWxsPSIjYTU5ZDgzIiBzdHJva2U9IiNlOGRmYzYiIHN0cm9rZS13aWR0aD0iMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxjaXJjbGUgY3g9IjIxLjUiIGN5PSIyMS41IiByPSI3IiBmaWxsPSIjNmYxZjIyIiBzdHJva2U9IiNmM2IwYTciIHN0cm9rZS13aWR0aD0iMS42Ii8+CiAgPHBhdGggZD0ibTE3LjEgMTcuMSA4LjggOC44IiBzdHJva2U9IiNmZmU1ZDQiIHN0cm9rZS13aWR0aD0iMi4yIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPC9zdmc+Cg==") 3 3, not-allowed;
  --cursor-help: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8cGF0aCBkPSJNMyAyLjUgMjQuNSAxNGwtOSAyLjIgNS40IDkuMi01IDIuOS01LjMtOS4zLTYuMiA2LjlaIiBmaWxsPSIjMWExMjA5IiBzdHJva2U9IiMwOTA3MDQiIHN0cm9rZS13aWR0aD0iMyIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxwYXRoIGQ9Ik0zLjcgMy41IDIzIDEzLjhsLTguOSAyLjEgNS41IDkuMy0zLjQgMi01LjUtOS41LTUuNSA2LjFaIiBmaWxsPSIjZjJjMTRlIiBzdHJva2U9IiNmZmYwYTgiIHN0cm9rZS13aWR0aD0iMSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPgogIDxjaXJjbGUgY3g9IjI0IiBjeT0iMjIuNSIgcj0iNi4yIiBmaWxsPSIjMTcxMjBiIiBzdHJva2U9IiNmMmMxNGUiIHN0cm9rZS13aWR0aD0iMS40Ii8+CiAgPHBhdGggZD0iTTIxLjggMjAuNmMuMS0xLjQgMS0yLjMgMi40LTIuMyAxLjUgMCAyLjUuOCAyLjUgMiAwIDEuMS0uNSAxLjYtMS42IDIuMy0uOC41LTEuMS45LTEuMSAxLjciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZjFiMSIgc3Ryb2tlLXdpZHRoPSIxLjgiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgogIDxjaXJjbGUgY3g9IjI0IiBjeT0iMjYuMiIgcj0iMSIgZmlsbD0iI2ZmZjFiMSIvPgo8L3N2Zz4K") 3 3, help;
  --game-speed-duration-scale: 1;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

/* Additional Latin-script locales need space for longer words on phones.
   Keep full words readable and keep workshop controls reachable at large text sizes. */
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-panel .section-heading {
  flex-wrap: wrap;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native #eventCapacity {
  flex: 0 0 auto;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-chip-title-row {
  grid-template-columns: minmax(0, 1fr);
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-chip-title-row > strong {
  font-size: 0.9em;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-chip-title-row > .event-timing-badges {
  max-width: 100%;
  justify-content: flex-start;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-chip .event-timing-badge {
  max-width: 100%;
  white-space: normal;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .card-workshop-panel {
  overflow-y: auto;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .event-list strong {
  font-size: 0.75rem;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .card-workshop-paint-actions {
  flex-wrap: wrap;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .card-workshop-paint-actions button {
  flex: 1 1 110px;
  min-width: 0;
  white-space: normal;
}
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .shop-upcoming-boss-name,
html:is(:lang(es), :lang(pt), :lang(fr), :lang(de), :lang(ko)) .android-native .shop-upcoming-boss-ability-name {
  overflow: visible;
  white-space: normal;
  overflow-wrap: break-word;
}

html[data-platform="android"] {
  overscroll-behavior: none;
}

.android-native #titleQuitButton,
.android-native #titleUpdateRequestButton,
.android-native #settingsUpdateRequestButton {
  display: none !important;
}

.android-native .title-screen {
  inset: 0;
  padding-top: calc(clamp(22px, 5vw, 72px) + env(safe-area-inset-top, 0px));
  padding-right: calc(clamp(26px, 6vw, 86px) + env(safe-area-inset-right, 0px));
  padding-bottom: calc(clamp(22px, 5vw, 72px) + env(safe-area-inset-bottom, 0px));
  padding-left: calc(clamp(26px, 6vw, 86px) + env(safe-area-inset-left, 0px));
}

.android-native .overlay {
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px);
  left: env(safe-area-inset-left, 0px);
}

/* Marking mode */
.title-mode-control {
  display: grid;
  align-items: stretch;
  gap: 10px;
}

.title-mode-control > span {
  color: var(--muted);
  font-weight: 800;
}

.title-mode-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.title-mode-button {
  min-height: 72px;
  border: 2px solid rgba(242, 193, 78, 0.34);
  border-radius: 10px;
  padding: 14px 12px;
  background: rgba(23, 24, 18, 0.96);
  color: #f1efe4;
  font: inherit;
  font-size: 1.03rem;
  font-weight: 950;
  cursor: var(--cursor-default);
}

.title-mode-button:hover:not(:disabled),
.title-mode-button:focus-visible {
  border-color: var(--gold);
}

.title-mode-button.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(242, 193, 78, 0.28), rgba(216, 148, 53, 0.18));
  color: #fff4d3;
  box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.12) inset;
}

.title-mode-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.title-mode-button.demo-full-version-lock::after {
  content: attr(data-unlock-label);
  display: block;
  margin-top: 6px;
  color: #ffe08a;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.25;
}

#titleGameModeDescription {
  grid-column: 1 / -1;
  max-width: 440px;
  margin: -2px 0 4px;
  color: var(--muted);
  line-height: 1.45;
}

.modal-panel.marking-panel {
  display: flex;
  width: 100%;
  height: 100%;
  max-height: none;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: clamp(14px, 1.6vw, 26px);
  box-shadow: none;
}

#markingOverlay {
  place-items: stretch;
  padding: 0;
  background: var(--panel-2);
}

.marking-panel > .modal-header {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.marking-stage {
  display: grid;
  min-height: 0;
  gap: 12px;
}

#markingChoiceStage {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

#markingPaintStage {
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 615px) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-items: start;
  column-gap: clamp(24px, 3vw, 52px);
}

#markingPaintStage .marking-name-field {
  grid-column: 3;
  grid-row: 1;
}

#markingPaintStage .marking-canvas-wrap {
  grid-column: 2;
  grid-row: 1 / 5;
  align-self: center;
  justify-self: center;
}

#markingPaintStage .marking-tools {
  grid-column: 3;
  grid-row: 2;
}

#markingPaintStage .settings-note {
  grid-column: 3;
  grid-row: 3;
  align-self: start;
  margin: 0;
}

#markingPaintStage .marking-paint-actions {
  grid-column: 3;
  grid-row: 4;
  align-self: end;
}

.marking-target-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(241, 200, 75, 0.42);
  border-radius: 12px;
  background: rgba(241, 200, 75, 0.07);
}

.marking-target-portrait {
  position: relative;
  width: 108px;
  height: 144px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid rgba(241, 200, 75, 0.45);
}

.marking-target-portrait > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.marking-target-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.marking-target-copy small {
  color: var(--muted);
}

.marking-target-copy strong {
  color: var(--gold);
  font-size: 1.12rem;
}

.marking-existing-section {
  display: grid;
  min-height: 0;
  gap: 10px;
}

.marking-existing-section h3 {
  margin: 0;
}

.marking-existing-marks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  align-content: start;
  gap: 8px;
}

.marking-existing-button {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 10px;
  min-height: 62px;
  padding: 6px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #11130f;
  cursor: var(--cursor-default);
}

.marking-existing-button:hover:not(:disabled),
.marking-existing-button:focus-visible {
  border-color: var(--gold);
}

.marking-existing-button:disabled {
  opacity: 0.48;
  cursor: default;
}

.marking-existing-button img {
  grid-row: 1 / 3;
  width: 50px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  background-color: #262821;
  background-image: linear-gradient(45deg, #32342d 25%, transparent 25%), linear-gradient(-45deg, #32342d 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #32342d 75%), linear-gradient(-45deg, transparent 75%, #32342d 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
}

.marking-existing-button span,
.marking-empty {
  color: var(--muted);
}

.marking-new-button {
  justify-self: start;
}

.marking-name-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.marking-name-field input {
  min-width: 0;
}

.marking-canvas-wrap {
  position: relative;
  width: auto;
  max-width: 100%;
  height: min(820px, calc(100vh - 132px));
  max-height: 100%;
  aspect-ratio: 3 / 4;
  margin-inline: 0;
  border: 2px solid rgba(241, 200, 75, 0.55);
  border-radius: 12px;
  overflow: hidden;
  background-color: #262821;
  background-image: linear-gradient(45deg, #33362e 25%, transparent 25%), linear-gradient(-45deg, #33362e 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #33362e 75%), linear-gradient(-45deg, transparent 75%, #33362e 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.marking-canvas-art {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  overflow: hidden;
  background: #141610;
}

.marking-canvas-art > img,
.marking-canvas-debuff-art {
  width: 100%;
  height: 100%;
}

.marking-canvas-art > img {
  display: block;
  object-fit: cover;
}

.marking-canvas-debuff-art {
  display: grid;
  place-items: center;
}

#markingCanvas {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.marking-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.marking-tools label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.marking-tools input[type="color"] {
  width: 48px;
  height: 38px;
  padding: 2px;
}

.marking-tools input[type="range"] {
  width: 150px;
}

.marking-tools .is-active {
  color: #12130f;
  border-color: var(--gold);
  background: var(--gold);
}

.marking-paint-actions {
  justify-content: space-between;
}

/* Card Workshop */
#cardWorkshopOverlay {
  place-items: stretch;
  padding: 0;
  background: var(--panel-2);
}

.modal-panel.card-workshop-panel {
  display: flex;
  width: 100%;
  height: 100%;
  max-height: none;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: clamp(14px, 1.6vw, 26px);
  box-shadow: none;
}

.card-workshop-panel > .modal-header {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.card-workshop-panel > .modal-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.card-workshop-layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(280px, 430px) minmax(280px, 390px);
  grid-template-rows: minmax(0, 1fr);
  justify-content: center;
  gap: clamp(16px, 2vw, 34px);
  min-height: 0;
}

.card-workshop-editor {
  display: contents;
}

.card-workshop-preview {
  grid-column: 2;
  align-self: center;
  justify-self: center;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  gap: 11px;
  width: min(100%, 420px, calc((100vh - 220px) * 0.75));
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 3px solid #d4c8aa;
  border-radius: 14px;
  padding: 11px;
  color: #17140f;
  background: linear-gradient(180deg, #fffbed 0%, #eee0bd 100%);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

.card-workshop-preview-image {
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #b5a989;
  border-radius: 7px;
  background:
    radial-gradient(circle at 50% 40%, rgba(242, 193, 78, 0.22), transparent 42%),
    linear-gradient(145deg, #373126, #171914);
}

.card-workshop-preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-workshop-preview-image > span {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border: 3px solid rgba(242, 193, 78, 0.76);
  border-radius: 50%;
  color: #fff4d3;
  font-size: 2.5rem;
  font-weight: 950;
}

.card-workshop-preview > strong {
  min-width: 0;
  overflow: hidden;
  color: #1c1811;
  font-size: 1.08rem;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-workshop-preview-fields,
.card-workshop-library-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.card-workshop-history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  min-width: 0;
}

.card-workshop-history > span:not(.country-flag) {
  display: inline-flex;
  min-width: 0;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  border: 1px solid #c5b383;
  border-radius: 999px;
  padding: 3px 9px;
  overflow: hidden;
  color: #2f2411;
  background: #fff4ce;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-workshop-preview-fields {
  justify-content: center;
  min-height: 29px;
}

.card-workshop-preview-fields span,
.card-workshop-library-fields span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 27px;
  border: 1px solid #d6c8a5;
  border-radius: 7px;
  padding: 3px 10px;
  color: #241d12;
  background: #fff9e6;
  font-size: 0.78rem;
  font-weight: 850;
}

.card-workshop-form {
  grid-column: 3;
  align-self: center;
  display: grid;
  align-content: start;
  gap: 16px;
  width: 100%;
  max-height: 100%;
  min-width: 0;
  overflow-y: auto;
  border: 1px solid rgba(241, 200, 75, 0.28);
  border-radius: 14px;
  padding: clamp(16px, 1.8vw, 24px);
  background: rgba(13, 14, 12, 0.68);
}

.card-workshop-form > label,
.card-workshop-history-editor > label,
.card-workshop-field-editor {
  display: grid;
  gap: 7px;
  color: #fff2c4;
  font-weight: 900;
}

.card-workshop-form input[type="text"],
.card-workshop-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid #626454;
  border-radius: 8px;
  padding: 11px 12px;
  color: #fff;
  background: #11130f;
  font: inherit;
}

.card-workshop-form select {
  color-scheme: dark;
}

.card-workshop-form input:disabled,
.card-workshop-form select:disabled {
  opacity: 0.58;
}

.card-workshop-history-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.card-workshop-image-row,
.card-workshop-field-entry,
.card-workshop-field-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card-workshop-paint-stage {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, min(75dvh, calc(100vw - 540px))) minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  align-items: start;
  min-height: 0;
  column-gap: clamp(24px, 3vw, 52px);
  row-gap: 12px;
}

.card-workshop-paint-canvas-wrap {
  grid-column: 2;
  grid-row: 1 / 5;
  align-self: center;
  justify-self: center;
  width: auto;
  max-width: 100%;
  height: calc(100vh - clamp(28px, 3.2vw, 52px));
  height: calc(100dvh - clamp(28px, 3.2vw, 52px));
  max-height: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 2px solid #d4c8aa;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.42);
}

#cardWorkshopPaintCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
  background: #fff;
}

.card-workshop-paint-copy {
  grid-column: 3;
  grid-row: 1;
}

.card-workshop-paint-copy h3 {
  margin: 0 0 6px;
  color: var(--gold);
}

.card-workshop-paint-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.card-workshop-paint-tools {
  grid-column: 3;
  grid-row: 2;
  align-content: start;
  align-items: flex-start;
}

.card-workshop-paint-stage > .settings-note {
  grid-column: 3;
  grid-row: 3;
  align-self: stretch;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  margin: 0;
}

.card-workshop-paint-actions {
  grid-column: 3;
  grid-row: 4;
  display: flex;
  align-self: end;
  justify-content: space-between;
  gap: 8px;
}

.card-workshop-completion-stage {
  position: relative;
  isolation: isolate;
  flex: 1 1 auto;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(14px, 2vh, 30px) clamp(18px, 3vw, 38px);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 222, 102, 0.2), transparent 34%),
    radial-gradient(circle at 50% 45%, rgba(242, 193, 78, 0.1), transparent 56%),
    linear-gradient(180deg, rgba(17, 18, 14, 0.08), rgba(17, 18, 14, 0.66));
}

.card-workshop-completion-stage::after {
  position: absolute;
  z-index: 0;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 28%, rgba(4, 5, 4, 0.58) 100%);
  content: "";
  pointer-events: none;
}

.card-workshop-completion-rays {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: min(86vmin, 920px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  background: repeating-conic-gradient(
    from -3deg,
    rgba(255, 224, 118, 0.3) 0deg 2deg,
    transparent 2deg 11deg
  );
  mask-image: radial-gradient(circle, transparent 0 16%, #000 34%, transparent 70%);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.45) rotate(-20deg);
}

.card-workshop-completion-panel {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: clamp(8px, 1.4vh, 15px);
  width: min(620px, 100%);
  margin: auto;
  text-align: center;
}

.card-workshop-completion-kicker {
  color: #ffe27a;
  font-size: clamp(0.72rem, 1.4vw, 0.9rem);
  font-weight: 1000;
  letter-spacing: 0.2em;
  text-shadow: 0 0 18px rgba(242, 193, 78, 0.52);
}

.card-workshop-completion-panel h3 {
  margin: 0;
  color: #fff3bd;
  font-size: clamp(1.65rem, 4.2vw, 2.75rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-shadow:
    0 2px 0 #6d4a08,
    0 0 26px rgba(255, 216, 91, 0.52);
}

.card-workshop-completion-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  width: min(340px, 43vh, calc(100vw - 48px));
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 2px solid #f0d77f;
  border-radius: 16px;
  padding: 12px;
  color: #17140f;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), transparent 30%),
    linear-gradient(180deg, #fffbed 0%, #ead9a8 100%);
  box-shadow:
    0 0 0 1px rgba(72, 49, 11, 0.84),
    0 0 44px rgba(242, 193, 78, 0.42),
    0 28px 58px rgba(0, 0, 0, 0.62);
  transform-origin: 50% 72%;
}

.card-workshop-completion-card::before {
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(115, 78, 18, 0.48);
  border-radius: 11px;
  content: "";
  pointer-events: none;
}

.card-workshop-completion-card::after {
  position: absolute;
  top: -34%;
  bottom: -34%;
  left: -78%;
  width: 44%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.82), transparent);
  content: "";
  pointer-events: none;
  transform: rotate(16deg);
}

.card-workshop-completion-image {
  display: block;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #9d8b5e;
  border-radius: 10px;
  background: #171914;
}

.card-workshop-completion-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.card-workshop-completion-card > strong {
  display: -webkit-box;
  min-width: 0;
  min-height: 2.5em;
  overflow: hidden;
  padding-inline: 6px;
  color: #1c1811;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  font-weight: 1000;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-overflow: ellipsis;
  white-space: normal;
}

.card-workshop-completion-fields {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  min-height: 27px;
}

.card-workshop-completion-fields span {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  justify-content: center;
  border: 1px solid #a78336;
  border-radius: 999px;
  padding: 3px 9px;
  color: #33240d;
  background: rgba(255, 250, 224, 0.8);
  font-size: 0.72rem;
  font-weight: 900;
}

.card-workshop-completion-panel > p {
  margin: 0;
  color: #eee6cc;
  font-weight: 750;
}

.card-workshop-completion-panel > button {
  min-width: min(260px, 100%);
  min-height: 48px;
}

.card-workshop-completion-stage.is-presenting .card-workshop-completion-rays {
  animation: card-workshop-completion-rays calc(920ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.16, 0.82, 0.22, 1) both;
}

.card-workshop-completion-stage.is-presenting .card-workshop-completion-card {
  animation: card-workshop-completion-card calc(880ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.14, 0.86, 0.2, 1) both;
}

.card-workshop-completion-stage.is-presenting .card-workshop-completion-card::after {
  animation: card-workshop-completion-shine calc(820ms * var(--game-speed-duration-scale, 1)) ease-out calc(130ms * var(--game-speed-duration-scale, 1)) both;
}

.card-workshop-completion-stage.is-presenting .card-workshop-completion-kicker,
.card-workshop-completion-stage.is-presenting .card-workshop-completion-panel h3,
.card-workshop-completion-stage.is-presenting .card-workshop-completion-panel > p,
.card-workshop-completion-stage.is-presenting .card-workshop-completion-panel > button {
  animation: card-workshop-completion-copy calc(460ms * var(--game-speed-duration-scale, 1)) ease-out calc(240ms * var(--game-speed-duration-scale, 1)) both;
}

@keyframes card-workshop-completion-card {
  0% {
    opacity: 0;
    filter: brightness(1.55) blur(3px);
    transform: translateY(40px) rotate(-4deg) scale(0.58);
  }
  54% {
    opacity: 1;
    filter: brightness(1.12) blur(0);
    transform: translateY(-6px) rotate(1.2deg) scale(1.075);
  }
  76% {
    filter: brightness(1.04);
    transform: translateY(2px) rotate(-0.35deg) scale(0.985);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    transform: translateY(0) rotate(0) scale(1);
  }
}

@keyframes card-workshop-completion-rays {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.38) rotate(-22deg); }
  52% { opacity: 0.68; }
  100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1) rotate(0); }
}

@keyframes card-workshop-completion-shine {
  0% { left: -78%; opacity: 0; }
  18% { opacity: 0.82; }
  100% { left: 138%; opacity: 0; }
}

@keyframes card-workshop-completion-copy {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-workshop-field-entry {
  flex-wrap: nowrap;
}

.card-workshop-field-entry input {
  flex: 1 1 auto;
}

.card-workshop-field-entry select {
  flex: 0 1 148px;
  width: 148px;
}

.card-workshop-field-entry button {
  flex: 0 0 auto;
  min-width: 72px;
  white-space: nowrap;
}

.card-workshop-field-chip {
  border: 1px solid rgba(242, 193, 78, 0.62);
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff1b9;
  background: rgba(242, 193, 78, 0.1);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 850;
  cursor: var(--cursor-default);
}

.card-workshop-field-chip:hover,
.card-workshop-field-chip:focus-visible {
  border-color: #ffe274;
  background: rgba(242, 193, 78, 0.2);
}

.card-workshop-field-editor small {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.card-workshop-submit-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

#cancelWorkshopCardEditButton.hidden + .card-workshop-create-button {
  grid-column: 1 / -1;
}

.card-workshop-create-button {
  justify-self: stretch;
  min-height: 52px;
}

.card-workshop-library {
  grid-column: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: rgba(13, 14, 12, 0.68);
}

.card-workshop-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 2px 2px 11px;
}

.card-workshop-library-header h3 {
  margin: 0;
  color: var(--gold);
}

.card-workshop-library-header span {
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 999px;
  padding: 4px 9px;
  color: #fff1b9;
  font-size: 0.78rem;
  font-weight: 900;
}

.card-workshop-cards {
  display: grid;
  align-content: start;
  gap: 9px;
  min-height: 0;
  overflow: auto;
  padding: 12px 2px 2px;
}

.card-workshop-library-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #3d4035;
  border-radius: 9px;
  padding: 8px;
  background: #151713;
}

.card-workshop-library-card > img {
  width: 70px;
  height: 92px;
  object-fit: cover;
  border: 1px solid #69614d;
  border-radius: 6px;
}

.card-workshop-library-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-width: 0;
}

.card-workshop-library-history {
  justify-content: flex-start;
}

.card-workshop-library-card strong {
  overflow: hidden;
  color: #fff1b9;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-workshop-library-fields span {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.card-workshop-delete-button {
  min-width: 64px;
}

.card-workshop-library-actions {
  display: grid;
  align-self: stretch;
  align-content: space-between;
  gap: 8px;
}

.card-workshop-library-actions > button {
  min-width: 88px;
}

.card-workshop-empty {
  align-self: center;
  margin: 0;
  border: 1px dashed #484b3f;
  border-radius: 9px;
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .card-workshop-layout {
    grid-template-columns: minmax(180px, 240px) minmax(240px, 330px) minmax(250px, 1fr);
    gap: 14px;
  }

  .card-workshop-form {
    padding: 14px;
  }

  .card-workshop-history-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  #cardWorkshopPaintStage {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) minmax(0, 1fr);
  }

  .card-workshop-paint-canvas-wrap {
    height: min(560px, calc(100vh - 132px));
  }
}

@media (max-width: 720px) {
  .modal-panel.card-workshop-panel {
    overflow: auto;
  }

  .card-workshop-layout {
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  .card-workshop-preview,
  .card-workshop-form,
  .card-workshop-library {
    grid-column: 1;
  }

  .card-workshop-preview {
    grid-row: 1;
    width: min(100%, 300px);
  }

  .card-workshop-form {
    grid-row: 2;
    overflow: visible;
  }

  .card-workshop-library {
    grid-row: 3;
    min-height: 280px;
  }

  #cardWorkshopPaintStage {
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
  }

  #cardWorkshopPaintStage .card-workshop-paint-copy,
  #cardWorkshopPaintStage .card-workshop-paint-canvas-wrap,
  #cardWorkshopPaintStage .card-workshop-paint-tools,
  #cardWorkshopPaintStage > .settings-note,
  #cardWorkshopPaintStage .card-workshop-paint-actions {
    grid-column: 1;
  }

  #cardWorkshopPaintStage .card-workshop-paint-copy {
    grid-row: 1;
  }

  #cardWorkshopPaintStage .card-workshop-paint-canvas-wrap {
    grid-row: 2;
    width: min(100%, 300px);
    height: auto;
  }

  #cardWorkshopPaintStage .card-workshop-paint-tools {
    grid-row: 3;
  }

  #cardWorkshopPaintStage > .settings-note {
    grid-row: 4;
  }

  #cardWorkshopPaintStage .card-workshop-paint-actions {
    grid-row: 5;
  }

  .card-workshop-completion-stage {
    flex: 1 0 auto;
    min-height: calc(100vh - 104px);
    padding: 16px;
  }

  .card-workshop-completion-panel {
    gap: 8px;
  }

  .card-workshop-completion-card {
    width: min(300px, 42vh, calc(100vw - 38px));
    padding: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-rays,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-card,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-card::after,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-kicker,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-panel h3,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-panel > p,
  .card-workshop-completion-stage.is-presenting .card-workshop-completion-panel > button {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }
}

.flag-custom {
  border-color: rgba(242, 193, 78, 0.64) !important;
  background:
    radial-gradient(circle at 50% 50%, #fff0ad 0 12%, transparent 13%),
    conic-gradient(from 40deg, #d86252, #f2c14e, #6eafd5, #7865bb, #d86252) !important;
}

.card-mark-badges {
  position: absolute;
  z-index: 8;
  right: 5px;
  bottom: 5px;
  display: flex;
  flex-wrap: wrap-reverse;
  justify-content: flex-end;
  gap: 3px;
  max-width: calc(100% - 10px);
  pointer-events: none;
}

.card-mark-art-layers {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  pointer-events: none;
}

.card-mark-art-layers img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
}

.card-mark-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 24px;
  overflow: hidden;
  border: 1px solid #f6dd75;
  border-radius: 6px;
  background: rgba(8, 9, 7, 0.88);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
}

.card-mark-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.codex-card-portrait,
.person-card .portrait {
  position: relative;
}

.deck-card-mark-badges .card-mark-badge {
  width: 27px;
  height: 22px;
}

.shop-service-items.has-marking-service {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
  #markingPaintStage {
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px) minmax(0, 1fr);
  }

  .marking-canvas-wrap {
    height: min(560px, calc(100vh - 132px));
  }

  .shop-service-items.has-marking-service {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .modal-panel.marking-panel {
    width: 100%;
    height: 100%;
    max-height: none;
    overflow: auto;
  }

  #markingPaintStage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto;
  }

  #markingPaintStage .marking-name-field,
  #markingPaintStage .marking-canvas-wrap,
  #markingPaintStage .marking-tools,
  #markingPaintStage .settings-note,
  #markingPaintStage .marking-paint-actions {
    grid-column: 1;
    grid-row: auto;
  }

  #markingPaintStage .marking-canvas-wrap {
    justify-self: center;
    width: min(100%, 225px);
    height: auto;
  }

  .card-workshop-library-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .card-workshop-library-card > img {
    width: 58px;
    height: 76px;
  }

  .card-workshop-library-actions {
    grid-column: 1 / -1;
    display: flex;
  }

  .card-workshop-library-actions > button {
    flex: 1 1 0;
  }

  .card-workshop-field-entry {
    flex-wrap: wrap;
  }

  .card-workshop-field-entry select {
    flex: 1 1 100%;
    width: 100%;
  }

  .card-workshop-paint-actions {
    justify-content: stretch;
  }

  .card-workshop-paint-actions button {
    flex: 1 1 0;
  }

  .marking-existing-marks,
  .shop-service-items.has-marking-service {
    grid-template-columns: minmax(0, 1fr);
  }

  .marking-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .marking-tools label {
    justify-content: space-between;
  }
}

html { font-size: calc(16px * var(--text-scale, 1)); }

button:focus-visible,
select:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #fff1a8;
  outline-offset: 3px;
}

body.high-contrast {
  --bg: #000;
  --panel: #090909;
  --panel-2: #111;
  --panel-3: #191919;
  --text: #fff;
  --muted: #ddd;
  --line: #aaa;
  --gold: #ffe15a;
  --green: #7dffae;
  --red: #ff7373;
}

body.final-boss-active {
  background:
    radial-gradient(circle at 50% 0%, rgba(213, 87, 87, 0.22), transparent 42%),
    linear-gradient(135deg, rgba(242, 193, 78, 0.08), transparent 34%),
    #100c0c;
}

body.final-boss-active .enemy-panel {
  border-color: rgba(213, 87, 87, 0.8);
  box-shadow: 0 0 34px rgba(213, 87, 87, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-wrap: normal;
  word-break: auto-phrase;
  cursor: var(--cursor-default);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.08), transparent 34%),
    radial-gradient(circle at 84% 12%, rgba(112, 166, 216, 0.12), transparent 28%),
    var(--bg);
  color: var(--text);
}

.title-screen {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: end start;
  overflow: hidden;
  padding: clamp(22px, 5vw, 72px) clamp(26px, 6vw, 86px);
  background:
    linear-gradient(90deg, rgba(12, 13, 11, 0.94) 0%, rgba(12, 13, 11, 0.72) 42%, rgba(12, 13, 11, 0.28) 100%),
    #10110f;
}

.title-portraits {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 0;
  opacity: 0.54;
}

.title-portraits img {
  width: 100%;
  height: 100%;
  min-width: 0;
  object-fit: cover;
  object-position: center top;
  filter: contrast(1.04);
}

.title-content {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 22px;
  width: min(1200px, 100%);
}

.title-heading-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: max-content;
  max-width: 100%;
}

.title-content h1 {
  max-width: none;
  color: #fff4d3;
  font-size: clamp(3.2rem, 9vw, 7.4rem);
  font-weight: 1000;
  line-height: 0.88;
  text-shadow: 0 14px 32px rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

.title-player-panel {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  width: min(560px, calc(100vw - 48px));
  transform: translateX(-50%);
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 8px;
  padding: 7px 11px 8px;
  background: rgba(12, 13, 11, 0.84);
  box-shadow: 0 7px 22px rgba(0, 0, 0, 0.32);
}

.android-native .title-player-panel {
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
}

.title-player-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-player-level {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  color: #e1ddca;
  font-size: 0.84rem;
  font-weight: 850;
}

.title-player-level strong {
  color: var(--gold);
  font-size: 1.08rem;
  font-weight: 1000;
}

.title-player-xp-label {
  flex: 0 0 auto;
  color: #f3e6ba;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.title-player-xp-bar {
  position: relative;
  flex: 1 1 auto;
  min-width: 72px;
  height: 8px;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.48);
  border-radius: 999px;
  background: rgba(3, 4, 3, 0.92);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55);
}

.title-player-xp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #a56c1d, #f2c14e 64%, #fff0a8);
  box-shadow: 0 0 10px rgba(242, 193, 78, 0.4);
}

.title-run-mode-panel {
  display: grid;
  gap: 12px;
  width: min(440px, 100%);
  border: 1px solid rgba(242, 193, 78, 0.58);
  border-radius: 10px;
  padding: 18px;
  background: rgba(12, 13, 11, 0.94);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.42);
}

.title-run-mode-panel h2 {
  margin: 0 0 2px;
  color: #fff4d3;
  font-size: 1.35rem;
}

.title-run-mode-panel p {
  margin: 0;
  color: #e1ddca;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.45;
}

.title-difficulty-stepper {
  display: grid;
  grid-template-columns: auto max-content;
  align-items: center;
  gap: 16px;
  border-top: 1px solid rgba(242, 193, 78, 0.24);
  padding-top: 12px;
  color: #fff4d3;
  font-weight: 950;
}

.title-difficulty-stepper-controls {
  display: inline-grid;
  grid-template-columns: 42px 34px 42px;
  align-items: center;
  gap: 4px;
  width: max-content;
}

.title-difficulty-stepper-controls button {
  min-width: 0;
  min-height: 42px;
  padding: 8px;
  font-size: 1.15rem;
}

#titleDifficultyValue {
  color: var(--gold);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.title-run-mode-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.title-run-mode-actions button {
  flex: 1;
}

.title-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  margin-top: clamp(24px, 3.5vh, 44px);
}

.title-actions button {
  min-width: 124px;
}

.title-locked-action {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 150px;
}

.title-locked-action button {
  width: 100%;
}

.title-locked-action small,
.title-unlock-hint {
  color: #ffe08a;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1.3;
}

.title-locked-action small {
  max-width: 170px;
  text-align: center;
}

.title-actions .title-locked-action button:disabled {
  border-color: rgba(242, 193, 78, 0.52);
  background: rgba(16, 17, 15, 0.9);
  color: #f1d886;
  filter: none;
  opacity: 0.78;
}

.title-start-button {
  min-width: 180px;
}

.build-badge {
  flex: 0 0 auto;
  width: max-content;
  margin: 0 0 0.16em;
  border: 1px solid var(--gold);
  padding: 5px 10px;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.compact-panel {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 22px;
}

.settings-list {
  display: grid;
  gap: 18px;
  margin: 24px 0;
}

.settings-list label,
.settings-switch-row,
.difficulty-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.settings-list select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  background: var(--panel-3);
  color: var(--text);
}

.settings-list .bgm-track-setting select {
  width: min(420px, 62vw);
  min-width: 0;
  max-width: 100%;
}

.credits-content {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.credits-content h3 {
  margin: 12px 0 0;
  color: var(--gold);
}

.settings-list input[type="range"] {
  width: min(320px, 55vw);
}

.game-speed-control {
  display: grid;
  grid-template-columns: minmax(116px, auto) minmax(180px, 1fr);
  align-items: center;
  gap: 12px;
  min-width: min(430px, 68vw);
}

.game-speed-control output {
  min-width: 116px;
  color: var(--gold);
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.game-speed-control #gameSpeedInput {
  width: 100%;
}

.settings-switch-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 106px;
  cursor: var(--cursor-default);
}

.settings-switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.settings-switch-track {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 54px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #171816;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.settings-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #9a9a91;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.55);
  transition: transform 140ms ease, background 140ms ease;
}

.settings-switch-control input:checked + .settings-switch-track {
  border-color: #f2c14e;
  background: rgba(242, 193, 78, 0.32);
  box-shadow: 0 0 12px rgba(242, 193, 78, 0.24), inset 0 2px 5px rgba(0, 0, 0, 0.3);
}

.settings-switch-control input:checked + .settings-switch-track .settings-switch-thumb {
  transform: translateX(24px);
  background: #ffd76a;
}

.settings-switch-control input:focus-visible + .settings-switch-track {
  outline: 3px solid rgba(255, 215, 106, 0.5);
  outline-offset: 3px;
}

.settings-switch-control output {
  min-width: 32px;
  color: var(--muted);
  font-weight: 900;
  text-align: right;
}

.settings-switch-control input:checked ~ output {
  color: #ffd76a;
}

.settings-actions,
.tutorial-actions {
  justify-content: space-between;
  gap: 10px;
}

.settings-navigation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.danger-button {
  border: 1px solid rgba(213, 87, 87, 0.7);
  border-radius: var(--radius);
  padding: 9px 14px;
  background: rgba(213, 87, 87, 0.12);
  color: #ffb2b2;
  cursor: var(--cursor-default);
}

.settings-note {
  margin-top: 14px;
  font-size: 0.9rem;
}

.update-request-panel {
  width: min(620px, calc(100vw - 32px));
  max-height: min(92vh, 780px);
  overflow-y: auto;
}

.update-request-form {
  display: grid;
  gap: 9px;
}

.update-request-form label {
  color: var(--gold);
  font-weight: 800;
}

.update-request-form select,
.update-request-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #10110f;
  color: var(--text);
  font: inherit;
}

.update-request-form textarea {
  height: clamp(110px, 20vh, 170px);
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.update-request-form select:focus-visible,
.update-request-form textarea:focus-visible,
.update-request-terms summary:focus-visible,
.update-request-consent input:focus-visible {
  outline: 3px solid rgba(242, 193, 78, 0.65);
  outline-offset: 2px;
}

.update-request-terms {
  margin-top: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.update-request-terms summary {
  padding: 10px 12px;
  color: var(--gold);
  font-weight: 800;
  cursor: var(--cursor-default);
}

.update-request-terms-body {
  max-height: min(30vh, 240px);
  overflow-y: auto;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.update-request-terms-body p {
  margin: 0 0 10px;
}

.update-request-terms-body p:last-child {
  margin-bottom: 0;
}

.update-request-form .update-request-consent {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: var(--cursor-default);
}

.update-request-consent input {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--gold);
}

.tutorial-content {
  min-height: 0;
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.45;
}

.tutorial-content p {
  margin: 0;
  color: #fff;
  text-wrap: pretty;
}

#tutorialOverlay,
#enemyArrivalNotice,
#clearConditionMessage {
  position: relative;
  inset: auto;
  z-index: 10;
  display: flex;
  flex: 0 0 auto;
  width: 100%;
  height: auto;
  place-items: initial;
  justify-content: center;
  padding: 0;
  background: transparent;
  pointer-events: none;
}

.battle-status-row {
  position: relative;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.battle-status-row > .scoring-strip {
  flex: 0 0 clamp(184px, 16vw, 236px);
  width: clamp(184px, 16vw, 236px);
  min-width: 0;
}

.battle-status-row > .run-card {
  flex: 0 0 clamp(310px, 22vw, 360px);
  width: clamp(310px, 22vw, 360px);
  min-width: 0;
  padding: 9px 10px;
}

.battle-status-row > .run-card .run-title {
  margin-bottom: 8px;
}

.battle-status-row > #tutorialOverlay,
.battle-status-row > #enemyArrivalNotice,
.battle-status-row > #clearConditionMessage {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
}

.battle-status-row > #tutorialOverlay,
.battle-status-row > #enemyArrivalNotice,
.battle-status-row > #clearConditionMessage {
  order: -1;
}

.battle-status-row.boss-effect-visible > #enemyArrivalNotice {
  order: -2;
}

.enemy-arrival-message {
  display: grid;
  gap: 3px;
  place-items: center;
  width: max-content;
  max-width: min(900px, 100%);
  margin: 0;
  border: 1px solid rgba(255, 108, 88, 0.78);
  border-radius: var(--radius);
  padding: 8px 18px;
  background:
    linear-gradient(135deg, rgba(102, 29, 22, 0.96), rgba(35, 24, 18, 0.96)),
    #291713;
  box-shadow: 0 0 30px rgba(255, 108, 88, 0.18);
  color: #fff;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-align: center;
}

.enemy-arrival-message.is-boss {
  border-color: rgba(247, 196, 90, 0.78);
  background:
    linear-gradient(135deg, rgba(126, 31, 25, 0.96), rgba(70, 51, 18, 0.96)),
    #291713;
  box-shadow: 0 0 32px rgba(247, 196, 90, 0.24);
}

.enemy-arrival-label,
.enemy-arrival-detail {
  font-size: 0.78rem;
  line-height: 1.35;
}

.enemy-arrival-label {
  color: #ffb0a8;
  letter-spacing: 0.14em;
}

.enemy-arrival-title {
  color: #fff1c4;
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1.2;
}

.enemy-arrival-detail {
  max-width: 760px;
  color: #fff;
  font-weight: 750;
  letter-spacing: 0;
  text-wrap: pretty;
}

.enemy-arrival-label:empty,
.enemy-arrival-detail:empty {
  display: none;
}

.battle-status-row.tutorial-visible ~ .synergy-list,
.battle-status-row.enemy-intro-visible ~ .synergy-list,
.battle-status-row.clear-condition-tutorial-visible ~ .synergy-list {
  display: none;
}

.battle-status-row.connection-power-tutorial-visible > #enemyArrivalNotice {
  display: none !important;
}

.tutorial-content .connection-power-tutorial-text {
  color: #ffd76a;
}

.modal-panel.tutorial-panel {
  width: max-content;
  max-width: min(900px, 100%);
  max-height: none;
  margin: 0;
  overflow: visible;
  padding: 10px 18px;
  pointer-events: none;
}

#discardGuidanceOverlay {
  z-index: 240;
  place-items: initial;
  background: rgba(0, 0, 0, 0.84);
}

.modal-panel.discard-guidance-panel {
  position: fixed;
  display: grid;
  width: max-content;
  min-width: min(420px, calc(100vw - 36px));
  max-width: min(520px, calc(100vw - 36px));
  gap: 20px;
  padding: 24px;
  pointer-events: auto;
}

.discard-guidance-panel .tutorial-content {
  font-size: clamp(1rem, 1.35vw, 1.14rem);
}

.discard-guidance-actions {
  display: flex;
  justify-content: flex-end;
}

.discard-guidance-actions .primary-button {
  min-width: 120px;
}

body.discard-guidance-visible #discardButton {
  position: relative;
  z-index: 241;
  border-color: var(--gold);
  background: #11120f;
  filter: none;
  opacity: 1;
  box-shadow:
    0 0 0 3px rgba(255, 225, 90, 0.24),
    0 10px 28px rgba(0, 0, 0, 0.48);
}

body.discard-guidance-visible #discardButton:disabled {
  cursor: default;
  filter: none;
  opacity: 1;
}

#lastHandGuidanceOverlay {
  z-index: 240;
  place-items: initial;
  background: rgba(0, 0, 0, 0.84);
}

.modal-panel.last-hand-guidance-panel {
  position: fixed;
  display: grid;
  width: max-content;
  min-width: min(420px, calc(100vw - 36px));
  max-width: min(560px, calc(100vw - 36px));
  gap: 20px;
  padding: 24px;
  pointer-events: auto;
}

.last-hand-guidance-panel .tutorial-content {
  color: #fff2bd;
  font-size: clamp(1rem, 1.35vw, 1.14rem);
  font-weight: 900;
}

.last-hand-guidance-actions {
  display: flex;
  justify-content: flex-end;
}

.last-hand-guidance-actions .primary-button {
  min-width: 120px;
}

body.last-hand-guidance-visible #playButton {
  position: relative;
  z-index: 241;
  border-color: var(--gold);
  background: #11120f;
  color: #fff2bd;
  filter: none;
  opacity: 1;
  box-shadow:
    0 0 0 3px rgba(255, 225, 90, 0.24),
    0 10px 28px rgba(0, 0, 0, 0.48);
}

body.last-hand-guidance-visible #playButton:disabled {
  cursor: default;
  filter: none;
  opacity: 1;
}


.stats-grid {
  margin: 22px 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.difficulty-select select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  background: var(--panel-3);
  color: var(--text);
}

@media (max-height: 720px) {
  .title-screen {
    place-items: start center;
    overflow-x: hidden;
    overflow-y: auto;
    padding-bottom: 80px;
  }

  .android-native .title-screen {
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  .android-native .title-screen:not(.run-mode-open) {
    place-items: end start;
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  .android-native .title-screen:not(.run-mode-open) #titleCreditsButton {
    position: fixed;
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    z-index: 3;
    min-width: 124px;
  }

  .title-content {
    gap: 10px;
  }

  .title-content h1 {
    font-size: clamp(2.4rem, 7vw, 4.2rem);
  }

  .title-screen.run-mode-open .title-heading-row {
    display: none;
  }

  .title-screen.run-mode-open .title-run-mode-panel {
    gap: 7px;
    padding: 12px;
  }

  .title-screen.run-mode-open .title-run-mode-panel h2 {
    font-size: 1.08rem;
  }

  .title-screen.run-mode-open .title-mode-control,
  .title-screen.run-mode-open .title-mode-buttons {
    gap: 6px;
  }

  .title-screen.run-mode-open .title-mode-button {
    min-height: 48px;
    padding: 8px 10px;
    font-size: 0.92rem;
  }

  .title-screen.run-mode-open .title-run-mode-panel p {
    font-size: 0.76rem;
    line-height: 1.3;
  }

  .title-screen.run-mode-open #titleGameModeDescription {
    margin-bottom: 0;
  }

  .title-screen.run-mode-open .title-difficulty-stepper {
    gap: 10px;
    padding-top: 7px;
  }

  .title-screen.run-mode-open .title-difficulty-stepper-controls button {
    min-height: 36px;
    padding: 5px;
  }

  .title-screen.run-mode-open .title-run-mode-actions > button {
    min-height: 40px;
    padding-block: 7px;
  }
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: clamp(230px, 15vw, 260px) minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  padding: 14px;
}

.left-panel,
.table-panel {
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(25, 26, 23, 0.92);
  box-shadow: var(--shadow);
}

.left-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.table-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 10px;
  padding: 14px;
}

.brand-row,
.top-bar,
.modal-header,
.section-heading,
.run-title,
.action-bar,
.top-actions {
  display: flex;
  align-items: center;
}

.brand-row {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(242, 193, 78, 0.55);
  background: linear-gradient(145deg, #332516, #6a4721);
  color: #f8dfa0;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.18rem;
  line-height: 1.1;
}

h2 {
  font-size: clamp(1.1rem, 2.2vw, 1.75rem);
  line-height: 1.1;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.run-card,
.collection-panel,
.log-panel,
.enemy-panel,
.scoring-strip,
.modal-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.run-card,
.collection-panel,
.log-panel {
  padding: 11px;
}

.run-title {
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

#roundLabel {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  column-gap: 0.42em;
  min-width: 0;
  line-height: 1.25;
}

#roundLabel > span {
  flex: 0 0 auto;
  min-width: 0;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
}

#blindName {
  display: none;
}

.run-title span,
.scoring-strip span,
.shop-money,
.section-heading {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.run-title strong {
  color: var(--gold);
}

.run-money {
  flex: 0 0 auto;
  min-width: max-content;
  border-left: 1px solid rgba(247, 196, 90, 0.32);
  padding-left: 9px;
  color: var(--gold);
  font-size: 0.95rem;
  line-height: 1;
  white-space: nowrap;
}

.run-info-panel {
  width: min(720px, 100%);
}

.run-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.run-info-grid > div,
.run-info-boss-card,
.run-info-round {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 18, 15, 0.72);
}

.run-info-grid > div {
  display: grid;
  gap: 4px;
  padding: 11px;
}

.run-info-grid span,
.run-info-boss-card span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.run-info-grid strong {
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.1;
}

.run-info-boss-card {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 14px;
  border-color: rgba(247, 196, 90, 0.58);
  background: linear-gradient(135deg, rgba(126, 31, 25, 0.32), rgba(247, 196, 90, 0.1));
}

.run-info-boss-card strong {
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1.1;
}

.run-info-boss-card p {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

.run-info-rounds {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.run-info-round {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  padding: 10px;
}

.run-info-round span {
  grid-row: span 3;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(247, 196, 90, 0.14);
  color: var(--gold);
  font-weight: 900;
}

.run-info-round strong,
.run-info-round small,
.run-info-round em {
  min-width: 0;
}

.run-info-round strong {
  color: var(--text);
}

.run-info-round small {
  color: var(--muted);
  font-weight: 800;
}

.run-info-round em {
  color: var(--gold);
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 900;
}

.run-info-round.is-current {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(247, 196, 90, 0.16);
}

.run-info-round.is-boss {
  background: linear-gradient(135deg, rgba(126, 31, 25, 0.24), rgba(17, 18, 15, 0.82));
}

.score-meter {
  overflow: hidden;
  width: 100%;
  height: 12px;
  border: 1px solid #514833;
  border-radius: 999px;
  background: #11120f;
}

#scoreFill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width calc(240ms * var(--game-speed-duration-scale, 1)) ease;
}

.scoring-strip {
  display: grid;
}

.scoring-strip strong {
  display: block;
  color: var(--text);
  font-size: 1.18rem;
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 10px;
}

.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #11120f;
  color: var(--text);
  cursor: var(--cursor-default);
}

.collection-list {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.collection-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.event-panel {
  flex: 1 1 0;
  min-height: 96px;
  max-height: none;
  border-color: rgba(102, 197, 210, 0.38);
  background:
    linear-gradient(145deg, rgba(68, 166, 184, 0.08), transparent 50%),
    var(--panel-2);
}

.event-list {
  flex: 1 1 auto;
  overflow-y: auto;
}

.legacy-panel .section-heading,
.event-panel .section-heading {
  justify-content: flex-start;
  gap: 10px;
}

.event-panel .section-heading {
  color: #8fd7df;
}

.event-capacity {
  display: inline-flex;
  min-width: 48px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(102, 197, 210, 0.42);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(68, 166, 184, 0.1);
  color: #b8edf1;
  font-size: 0.7rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.event-capacity.is-full,
.event-capacity[data-full="true"] {
  border-color: rgba(242, 193, 78, 0.58);
  background: rgba(242, 193, 78, 0.12);
  color: #f8dfa0;
}

.collection-chip,
.collection-empty,
.event-chip {
  border: 1px solid #514833;
  border-radius: 7px;
  padding: 8px;
  background: #171812;
}

.event-chip {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  border-color: rgba(102, 197, 210, 0.34);
  background:
    linear-gradient(145deg, rgba(68, 166, 184, 0.08), transparent 62%),
    #171812;
}

.collection-chip strong,
.event-chip strong {
  display: block;
  color: var(--gold);
  font-size: 0.9rem;
}

.event-chip strong {
  color: #b8edf1;
}

.event-chip-title-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px;
  min-width: 0;
}

.event-chip-title-row > strong {
  min-width: 0;
  line-height: 1.25;
  overflow-wrap: normal;
}

.event-owner-link {
  display: inline;
  margin-inline-start: 0.45rem;
  color: #d9d2bc;
  font-size: 0.72em;
  font-weight: 800;
}

.event-chip-title-row .event-owner-link {
  display: block;
  max-width: 100%;
  margin-inline-start: 0;
  color: #b8d9dc;
  white-space: normal;
  overflow-wrap: anywhere;
}

.event-chip-title-row > .event-timing-badges {
  max-width: 72px;
  justify-content: flex-end;
  margin: 0;
}

.event-chip-title-row .event-timing-badge {
  padding: 1px 5px;
  font-size: 0.6rem;
}

.event-chip em {
  border-color: rgba(102, 197, 210, 0.38);
  background: rgba(68, 166, 184, 0.1);
  color: #aee6eb;
}

.collection-chip em,
.event-chip em,
.shop-item-kind {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(242, 193, 78, 0.34);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(242, 193, 78, 0.1);
  color: var(--gold);
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 900;
}

.collection-chip em,
.event-chip em {
  margin-bottom: 5px;
}

.event-chip > .event-chip-state {
  grid-column: 1 / -1;
  margin: 0;
}

.collection-chip span,
.event-chip span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.event-chip .event-chip-description,
.event-chip .event-description,
.event-chip p {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
}

.event-timing-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: fit-content;
  margin: 0 0 6px;
}

.event-chip .event-timing-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.event-timing-badges .event-timing-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0;
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(242, 193, 78, 0.1);
  color: #f8dfa0;
  font-size: 0.67rem;
  font-weight: 900;
  line-height: 1.25;
  white-space: nowrap;
}

.event-timing-badges .event-timing-badge[data-timing="nextHand"] {
  border-color: rgba(102, 197, 210, 0.48);
  background: rgba(68, 166, 184, 0.12);
  color: #b8edf1;
}

.event-description-copy {
  display: block;
}

.event-description-copy.is-owner-enhanced {
  color: #ffe274;
  font-weight: 900;
}

.event-chip-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-top: 4px;
}

.event-chip .event-use-button,
.event-chip .event-discard-button,
.event-chip .event-cancel-use-button {
  width: 100%;
  min-height: 32px;
  border-color: rgba(102, 197, 210, 0.48);
  background: rgba(68, 166, 184, 0.14);
  color: #d7f7f9;
}

.event-chip .event-use-button:hover:not(:disabled),
.event-chip .event-use-button:focus-visible:not(:disabled),
.event-chip .event-discard-button:hover:not(:disabled),
.event-chip .event-discard-button:focus-visible:not(:disabled),
.event-chip .event-cancel-use-button:hover:not(:disabled),
.event-chip .event-cancel-use-button:focus-visible:not(:disabled) {
  border-color: #8fd7df;
  background: rgba(68, 166, 184, 0.24);
}

.event-chip .event-discard-button {
  width: auto;
  padding-inline: 10px;
  border-color: rgba(183, 178, 158, 0.28);
  background: rgba(17, 18, 14, 0.7);
  color: var(--muted);
}

.event-chip-cancel-actions {
  grid-template-columns: minmax(0, 1fr);
}

.event-chip.is-armed,
.event-chip.armed,
.event-chip[data-armed="true"] {
  border-color: #9be5eb;
  background:
    linear-gradient(145deg, rgba(76, 197, 207, 0.2), rgba(30, 86, 96, 0.08)),
    #171812;
  box-shadow:
    inset 0 0 18px rgba(102, 215, 222, 0.1),
    0 0 14px rgba(102, 215, 222, 0.18);
}

.event-chip.is-armed::before,
.event-chip.armed::before,
.event-chip[data-armed="true"]::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(184, 237, 241, 0.22);
  border-radius: 5px;
  pointer-events: none;
}

.collection-chip-empty,
.collection-empty,
.event-chip-empty {
  border-style: dashed;
  opacity: 0.78;
}

.event-chip-empty,
.event-list .collection-empty {
  border-color: rgba(102, 197, 210, 0.28);
}

.top-bar {
  justify-content: space-between;
  gap: 16px;
}

.top-bar p {
  margin-top: 6px;
}

.top-actions,
.action-bar {
  gap: 8px;
  flex-wrap: wrap;
}

#playButton,
#discardButton {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.action-count-button {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  line-height: 1.05;
}

#playButton.action-count-button,
#discardButton.action-count-button {
  min-height: 50px;
  padding: 5px 13px;
}

.action-count-label {
  display: block;
}

.action-count-dots {
  display: flex;
  min-width: 9px;
  min-height: 9px;
  max-width: 64px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transform: translateY(2px);
}

.action-count-dot {
  display: block;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border: 1px solid #9b6a00;
  border-radius: 50%;
  background: #ffd84d;
  box-shadow: 0 0 5px rgba(255, 216, 77, 0.78);
}

.action-count-dot.is-off {
  border-color: rgba(229, 188, 106, 0.88);
  background: #3a3022;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    inset 0 -2px 3px rgba(0, 0, 0, 0.82),
    0 0 0 1px rgba(13, 10, 6, 0.48);
}

.action-count-button:disabled {
  filter: none;
  opacity: 0.62;
}

.primary-button,
.secondary-button,
.icon-text-button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 13px;
  color: var(--text);
  font-weight: 900;
  cursor: var(--cursor-default);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background 140ms ease;
}

.primary-button {
  background: linear-gradient(180deg, #f0b64b, #b8652e);
  color: #23180c;
}

.secondary-button,
.icon-text-button {
  border-color: var(--line);
  background: #11120f;
}

.modal-close-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}

.icon-text-button.is-active {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(242, 193, 78, 0.24), rgba(216, 148, 53, 0.22));
  color: #ffe2a0;
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.18);
}

.primary-button:hover,
.secondary-button:hover,
.icon-text-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--gold);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.55;
  transform: none;
}

.scoring-strip {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  gap: 0;
  overflow: hidden;
  margin: 0;
  background: var(--panel-2);
}

.scoring-strip > div {
  display: grid;
  width: 100%;
  min-width: 0;
  place-items: center;
  padding: 9px;
  background: var(--panel-2);
}

.scoring-strip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enemy-panel {
  display: grid;
  order: -20;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: stretch;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 8px;
}

.enemy-summary {
  display: grid;
  align-content: center;
  justify-items: center;
  grid-row: 1 / 3;
  min-width: 0;
  border: 1px solid #514833;
  border-radius: 7px;
  padding: 8px;
  background: #171812;
}

.enemy-summary span,
.enemy-summary small {
  display: none;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.enemy-summary strong {
  overflow: hidden;
  color: var(--red);
  font-size: 2.05rem;
  line-height: 0.95;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enemy-health-bar {
  width: min(112px, 88%);
  height: 12px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 108, 88, 0.62);
  border-radius: 999px;
  background: rgba(31, 12, 10, 0.92);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7);
}

.enemy-health-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b82824, #ff6c58);
  box-shadow: 0 0 10px rgba(255, 108, 88, 0.35);
  transition: width calc(420ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.enemy-card-table {
  display: grid;
  grid-template-columns: repeat(var(--enemy-count, 5), minmax(0, 1fr));
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}

.enemy-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
  height: 78px;
  overflow: hidden;
  border: 1px solid #4a473a;
  border-radius: 7px;
  background: #ede6d3;
  color: var(--ink);
}

.enemy-card.boss-leader {
  position: relative;
  z-index: 1;
  border-color: #f2c14e;
  box-shadow:
    0 0 0 2px rgba(242, 193, 78, 0.34),
    0 0 16px rgba(242, 193, 78, 0.24);
}

.enemy-boss-power {
  position: absolute;
  z-index: 4;
  right: 4px;
  bottom: 4px;
  border: 1px solid rgba(255, 230, 120, 0.9);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(112, 27, 18, 0.94);
  color: #fff0a7;
  font-size: 0.62rem;
  font-weight: 1000;
  line-height: 1.2;
  text-shadow: 0 1px 2px #000;
}

.enemy-card.reveal-highlight {
  z-index: 2;
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(242, 193, 78, 0.45),
    0 0 18px rgba(242, 193, 78, 0.28);
  transform: translateY(-2px);
}

.enemy-card.reveal-dim {
  opacity: 0.44;
  filter: grayscale(0.45);
}

.enemy-portrait {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), transparent 42%),
    var(--accent, #8b6f47);
}

.enemy-portrait img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.enemy-initials {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(16, 17, 15, 0.35);
  color: white;
  font-size: 0.72rem;
  font-weight: 1000;
}

.enemy-card.image-loaded .enemy-initials {
  display: none;
}

.boss-decision-card-detail {
  position: absolute;
  z-index: 3;
  right: 5px;
  bottom: 5px;
  left: 5px;
  overflow: hidden;
  padding: 3px 5px;
  border: 1px solid rgba(255, 207, 74, 0.78);
  border-radius: 5px;
  background: rgba(10, 11, 9, 0.88);
  color: #fff2b3;
  font-size: clamp(0.54rem, 0.72vw, 0.68rem);
  font-weight: 850;
  line-height: 1.15;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enemy-card-body {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  padding: 6px 6px 6px 0;
}

.enemy-card-name {
  display: block;
  overflow: visible;
  font-size: 0.72rem;
  line-height: 1.15;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: normal;
  word-break: keep-all;
}

.enemy-card-name-part {
  white-space: normal;
}

.enemy-card .country-flag {
  flex-basis: 24px;
  width: 24px;
  height: 20px;
  border-radius: 5px;
}

.enemy-card .card-field {
  padding: 4px 5px;
  font-size: 0.62rem;
}

.enemy-card .card-fields {
  align-items: flex-start;
  flex-direction: column;
  gap: 2px;
}

.enemy-card .card-fields .card-field {
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  padding-block: 2px;
  white-space: nowrap;
}

.enemy-synergies {
  display: flex;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.enemy-synergies span {
  flex: 0 1 auto;
  overflow: hidden;
  border: 1px solid #504b35;
  border-radius: 999px;
  padding: 4px 7px;
  background: #171812;
  color: #d9cba0;
  font-size: 0.68rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enemy-synergies.reveal-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 62px;
}

.enemy-synergies.reveal-mode > .reveal-pill {
  flex: initial;
  width: 100%;
  border-color: #806334;
  border-radius: 7px;
  padding: 6px 8px;
  background: #1d1a12;
}

.enemy-synergies.reveal-mode > .reveal-pill.final {
  border-color: var(--gold);
  background: #2a2112;
}

.enemy-synergies.reveal-mode .reveal-pill span {
  flex: initial;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #d9cba0;
  font-size: 0.68rem;
  font-weight: 800;
}

.synergy-list {
  display: flex;
  min-height: 34px;
  gap: 6px;
  overflow: hidden;
  padding: 0;
}

.synergy-list.reveal-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 68px;
  max-height: 74px;
  align-items: stretch;
}

.synergy-pill {
  flex: 0 0 auto;
  border: 1px solid #504b35;
  border-radius: 999px;
  padding: 7px 10px;
  background: #171812;
  color: #e8d9aa;
  font-size: 0.78rem;
  font-weight: 800;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.reveal-pill {
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 0;
  border-color: #806334;
  border-radius: 7px;
  background: #1d1a12;
  animation: reveal-step calc(180ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.reveal-pill strong,
.reveal-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-pill strong {
  color: #f1d68e;
  font-size: 0.8rem;
}

.reveal-pill strong .reveal-base,
.reveal-pill strong .reveal-suffix,
.enemy-synergies.reveal-mode .reveal-pill strong .reveal-base,
.enemy-synergies.reveal-mode .reveal-pill strong .reveal-suffix {
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-overflow: clip;
  white-space: nowrap;
}

.reveal-pill.group-count {
  animation: none;
}

.reveal-pill.group-count .reveal-suffix {
  display: inline-block;
  animation: reveal-suffix calc(180ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.reveal-pill span {
  color: #d9cba0;
  font-size: 0.72rem;
}

.reveal-pill.final {
  border-color: var(--gold);
  background: #2a2112;
}

.reveal-pill.penalty {
  border-color: rgba(255, 105, 129, 0.78);
  background: linear-gradient(135deg, rgba(105, 22, 38, 0.96), rgba(31, 12, 17, 0.98));
}

.reveal-pill.penalty strong {
  color: #ff9aaa;
}

@keyframes reveal-step {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes reveal-suffix {
  from {
    opacity: 0;
    transform: translateX(-3px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.card-table {
  display: grid;
  flex: 0 0 clamp(350px, 48vh, 470px);
  grid-template-columns: repeat(var(--hand-count, 5), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: 8px;
  align-content: start;
  height: clamp(350px, 48vh, 470px);
  min-height: clamp(350px, 48vh, 470px);
  overflow: hidden;
  padding: 14px 0 0;
}

.person-card {
  position: relative;
  display: grid;
  grid-template-rows: minmax(86px, 52%) minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 2px solid #4a473a;
  border-radius: 8px;
  background: #ede6d3;
  color: var(--ink);
  cursor: var(--cursor-default);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.person-card:hover {
  transform: translateY(-2px);
}

.person-card.event-participant-card {
  cursor: default;
}

.person-card.event-participant-card:hover {
  transform: none;
}

.person-card.disabled {
  opacity: 0.54;
}

.person-card.disabled.deal-staged {
  opacity: 1;
  cursor: default;
}

.person-card.disabled.deal-staged:hover:not(.deal-enter) {
  transform: none;
}

.person-card.deal-enter {
  transform-origin: 50% 115%;
  animation: deal-card-in var(--deal-duration, 180ms) cubic-bezier(0.16, 0.82, 0.22, 1) both;
}

@keyframes deal-card-in {
  from {
    opacity: 0;
    filter: brightness(1.24);
    transform: translate(28px, -24px) rotate(2.8deg) scale(0.93);
  }
  72% {
    opacity: 1;
    filter: brightness(1.06);
    transform: translate(-2px, 1px) rotate(-0.35deg) scale(1.012);
  }
  to {
    opacity: 1;
    filter: brightness(1);
    transform: translate(0, 0) rotate(0) scale(1);
  }
}

.person-card.reveal-highlight {
  z-index: 3;
  border-color: var(--gold);
  box-shadow:
    0 0 0 2px rgba(242, 193, 78, 0.54),
    0 0 24px rgba(242, 193, 78, 0.36),
    0 14px 26px rgba(0, 0, 0, 0.3);
  transform: translateY(-4px);
}

.person-card.disabled.reveal-highlight {
  opacity: 1;
}

.person-card.reveal-highlight .portrait {
  filter: saturate(1.14) brightness(1.06);
}

.person-card.discard-selected {
  z-index: 2;
  border-color: #d77839;
  box-shadow:
    0 0 0 2px rgba(215, 120, 57, 0.42),
    0 16px 28px rgba(0, 0, 0, 0.32);
  transform: translateY(-10px);
}

.person-card.discard-selected:hover {
  transform: translateY(-12px);
}

.person-card.discard-selected .card-body {
  background:
    linear-gradient(180deg, rgba(255, 245, 224, 0.96), rgba(232, 195, 145, 0.98)),
    #f1d4a7;
}

.person-card.boss-penalty-card {
  border-color: #b94358;
  background: #210d13;
  box-shadow:
    0 0 0 1px rgba(229, 78, 102, 0.22),
    0 12px 24px rgba(0, 0, 0, 0.34);
}

.person-card.boss-penalty-card .card-body {
  border-top-color: rgba(255, 117, 138, 0.45);
  background:
    linear-gradient(180deg, rgba(79, 20, 31, 0.98), rgba(31, 10, 16, 0.99)),
    #210d13;
}

.person-card.boss-penalty-card .card-name {
  color: #fff4f5;
}

.person-card.boss-debuff-card {
  border-color: #9a65ca;
  background: #160d22;
  box-shadow:
    0 0 0 1px rgba(173, 105, 224, 0.24),
    0 12px 24px rgba(0, 0, 0, 0.38);
}

.person-card.boss-debuff-card .card-body {
  border-top-color: rgba(197, 137, 242, 0.48);
  background:
    linear-gradient(180deg, rgba(55, 27, 79, 0.98), rgba(20, 11, 31, 0.99)),
    #160d22;
}

.person-card.boss-debuff-card .card-name,
.codex-card.boss-debuff-card > strong,
.legacy-choice-card.boss-debuff-card > strong,
.legacy-choice-option.boss-debuff-card > strong {
  color: #f3e5ff;
}

.boss-debuff-portrait {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 40%, rgba(194, 130, 241, 0.3), transparent 35%),
    repeating-linear-gradient(145deg, rgba(255, 255, 255, 0.025) 0 9px, transparent 9px 18px),
    linear-gradient(145deg, #46235f, #100918 75%) !important;
}

.boss-debuff-portrait::before,
.boss-debuff-portrait::after {
  display: none !important;
}

.boss-debuff-illustration {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 68%;
  aspect-ratio: 1;
  border: 2px solid rgba(225, 188, 255, 0.52);
  border-radius: 50%;
  color: #ecd6ff;
  font-size: clamp(2.4rem, 5vw, 5rem);
  font-weight: 1000;
  line-height: 1;
  text-shadow:
    0 4px 18px rgba(0, 0, 0, 0.8),
    0 0 24px rgba(197, 126, 255, 0.6);
}

.boss-debuff-rule,
.codex-card .boss-debuff-rule,
.legacy-choice-option .boss-debuff-rule {
  display: grid;
  min-height: 28px;
  margin: 0;
  place-items: center;
  border: 1px solid rgba(202, 147, 244, 0.5);
  border-radius: 7px;
  padding: 4px 8px;
  background: rgba(70, 34, 98, 0.78);
  color: #f5eaff;
  font-size: clamp(0.68rem, 1vw, 0.82rem);
  font-weight: 950;
  line-height: 1.2;
  text-align: center;
}

.person-card.boss-debuff-card.debuff-neutralized,
.person-card.boss-penalty-card.debuff-neutralized,
.codex-card.boss-debuff-card.debuff-neutralized,
.codex-card.boss-penalty-card.debuff-neutralized,
.legacy-choice-option.boss-debuff-card.debuff-neutralized,
.legacy-choice-option.boss-penalty-card.debuff-neutralized {
  border-color: #e3bf4e;
  box-shadow:
    0 0 0 1px rgba(235, 200, 83, 0.28),
    0 12px 24px rgba(0, 0, 0, 0.34);
}

.debuff-neutralized .boss-debuff-rule,
.debuff-neutralized .boss-penalty-rule {
  border-color: rgba(241, 200, 75, 0.58);
  background: rgba(75, 65, 24, 0.82);
  color: #fff0a5;
}

.boss-penalty-portrait {
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(255, 101, 124, 0.25), transparent 36%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 8px, transparent 8px 16px),
    linear-gradient(145deg, #49121d, #17090d 72%) !important;
}

.boss-penalty-portrait::before,
.boss-penalty-portrait::after {
  display: none !important;
}

.boss-penalty-value,
.codex-card .boss-penalty-value {
  position: relative;
  z-index: 2;
  display: block;
  margin: 0;
  color: #ff8598;
  font-size: clamp(2.1rem, 5vw, 4.5rem);
  font-weight: 1000;
  line-height: 1;
  letter-spacing: -0.05em;
  text-shadow:
    0 3px 18px rgba(0, 0, 0, 0.72),
    0 0 22px rgba(255, 67, 98, 0.35);
}

.boss-penalty-rule,
.codex-card .boss-penalty-rule {
  display: grid;
  min-height: 28px;
  margin: 0;
  place-items: center;
  border: 1px solid rgba(255, 128, 148, 0.48);
  border-radius: 7px;
  padding: 4px 8px;
  background: rgba(96, 20, 34, 0.72);
  color: #ffe9ed;
  font-size: clamp(0.68rem, 1vw, 0.82rem);
  font-weight: 950;
  line-height: 1.2;
  text-align: center;
}

.portrait {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.24), transparent 42%),
    var(--accent, #8b6f47);
}

.portrait::before {
  content: "";
  position: absolute;
  bottom: -18px;
  width: 64px;
  height: 84px;
  border-radius: 45% 45% 18% 18%;
  background: rgba(30, 24, 20, 0.38);
}

.portrait::after {
  content: "";
  position: absolute;
  top: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 232, 186, 0.75);
  box-shadow: 0 56px 0 18px rgba(28, 24, 20, 0.24);
}

.portrait img {
  position: relative;
  z-index: 4;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.person-card.image-loaded .initials {
  display: none;
}

.person-card.image-loaded .portrait {
  background: #ede6d3;
}

.person-card.image-loaded .portrait::before,
.person-card.image-loaded .portrait::after {
  display: none;
}

.initials {
  position: relative;
  z-index: 3;
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(16, 17, 15, 0.35);
  color: white;
  font-weight: 1000;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.38);
}

.temporary-connection-badges {
  position: absolute;
  z-index: 7;
  left: 5px;
  bottom: 5px;
  display: grid;
  max-width: calc(100% - 42px);
  gap: 3px;
  justify-items: start;
  pointer-events: none;
}

.temporary-connection-badge {
  display: block;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(125, 236, 217, 0.92);
  border-radius: 999px;
  padding: 3px 6px;
  background: rgba(7, 36, 31, 0.94);
  color: #bffcf0;
  font-size: clamp(0.58rem, 0.72vw, 0.7rem);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.48);
}

.habit-progress {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 7;
  display: inline-grid;
  min-width: 42px;
  min-height: 24px;
  place-items: center;
  border: 1px solid rgba(255, 225, 126, 0.92);
  border-radius: 999px;
  padding: 2px 7px;
  background: rgba(28, 22, 8, 0.9);
  color: #ffe37c;
  font-size: clamp(0.62rem, 0.78vw, 0.74rem);
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.38);
}

.person-card.boss-marked-card {
  border-color: #f2c14e;
  box-shadow:
    0 0 0 2px rgba(242, 193, 78, 0.42),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.boss-card-mark {
  position: absolute;
  z-index: 6;
  top: 7px;
  left: 7px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #ffe899;
  border-radius: 50%;
  background: rgba(47, 31, 5, 0.94);
  color: #ffd85d;
  font-size: 1rem;
  line-height: 1;
  box-shadow: 0 0 12px rgba(242, 193, 78, 0.5);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 8px;
}

.card-name {
  display: block;
  overflow: hidden;
  font-size: 0.86rem;
  font-weight: 1000;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.enhanced-card-name-plus {
  display: inline-flex;
  min-width: 1.05em;
  min-height: 1.05em;
  align-items: center;
  justify-content: center;
  margin-left: 0.08em;
  border: 1px solid rgba(255, 232, 153, 0.92);
  border-radius: 0.28em;
  padding: 0 0.08em;
  background: rgba(18, 16, 8, 0.92);
  color: var(--gold);
  line-height: 1;
  text-shadow:
    -1px 0 #070805,
    0 1px #070805,
    1px 0 #070805,
    0 -1px #070805;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.72),
    0 0 6px rgba(242, 193, 78, 0.42);
  vertical-align: 0.04em;
  white-space: nowrap;
}

.card-status {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.card-meta-details {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.card-fields {
  display: flex;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
}

.card-fields .card-field {
  flex: 1 1 0;
  text-align: center;
}

.card-status .card-era {
  display: grid;
  align-items: center;
  align-self: flex-start;
  width: fit-content;
  min-height: 19px;
  margin: 0;
  border: 1px solid #d6c8ab;
  border-radius: 6px;
  padding: 2px 8px;
  color: #42382d;
  background: #ece7d8;
  font-size: 0.66rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.country-flag {
  position: relative;
  display: grid;
  flex: 0 0 32px;
  width: 32px;
  height: 28px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #d6c8ab;
  border-radius: 7px;
  background: #ece7d8;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-size: 0;
  line-height: 1;
}

.country-flag::before,
.country-flag::after {
  position: absolute;
  content: "";
}

.flag-us {
  background: repeating-linear-gradient(to bottom, #b22234 0 7.7%, #fff 7.7% 15.4%);
}

.flag-us::before {
  top: 0;
  left: 0;
  width: 46%;
  height: 54%;
  background: #3c3b6e;
}

.flag-us::after {
  top: 3px;
  left: 3px;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 5px 0 #fff, 10px 0 #fff, 0 4px #fff, 5px 4px #fff, 10px 4px #fff, 0 8px #fff, 5px 8px #fff;
}

.flag-gb {
  background:
    linear-gradient(0deg, transparent 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(90deg, transparent 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(0deg, transparent 46%, #c8102e 46% 54%, transparent 54%),
    linear-gradient(90deg, transparent 46%, #c8102e 46% 54%, transparent 54%),
    linear-gradient(34deg, transparent 43%, #fff 43% 49%, #c8102e 49% 51%, #fff 51% 57%, transparent 57%),
    linear-gradient(-34deg, transparent 43%, #fff 43% 49%, #c8102e 49% 51%, #fff 51% 57%, transparent 57%),
    #012169;
}

.flag-gb-eng {
  background:
    linear-gradient(0deg, transparent 40%, #ce1124 40% 60%, transparent 60%),
    linear-gradient(90deg, transparent 43%, #ce1124 43% 57%, transparent 57%),
    #fff;
}

.flag-gb-sct {
  background:
    linear-gradient(34deg, transparent 42%, #fff 42% 58%, transparent 58%),
    linear-gradient(-34deg, transparent 42%, #fff 42% 58%, transparent 58%),
    #0065bd;
}

.flag-de {
  background: linear-gradient(to bottom, #000 0 33.33%, #dd0000 33.33% 66.66%, #ffce00 66.66%);
}

.flag-pl {
  background: linear-gradient(to bottom, #fff 0 50%, #dc143c 50%);
}

.flag-it {
  background: linear-gradient(to right, #008c45 0 33.33%, #fff 33.33% 66.66%, #cd212a 66.66%);
}

.flag-fr {
  background: linear-gradient(to right, #0055a4 0 33.33%, #fff 33.33% 66.66%, #ef4135 66.66%);
}

.flag-nl {
  background: linear-gradient(to bottom, #ae1c28 0 33.33%, #fff 33.33% 66.66%, #21468b 66.66%);
}

.flag-ru {
  background: linear-gradient(to bottom, #fff 0 33.33%, #0039a6 33.33% 66.66%, #d52b1e 66.66%);
}

.flag-at {
  background: linear-gradient(to bottom, #ed2939 0 33.33%, #fff 33.33% 66.66%, #ed2939 66.66%);
}

.flag-es {
  background: linear-gradient(to bottom, #aa151b 0 25%, #f1bf00 25% 75%, #aa151b 75%);
}

.flag-pt {
  background: linear-gradient(to right, #006600 0 40%, #ff0000 40%);
}

.flag-pt::before {
  top: 9px;
  left: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffcc00;
}

.flag-rs {
  background: linear-gradient(to bottom, #c6363c 0 33.33%, #0c4076 33.33% 66.66%, #fff 66.66%);
}

.flag-gr {
  background: repeating-linear-gradient(to bottom, #0d5eaf 0 11.11%, #fff 11.11% 22.22%);
}

.flag-gr::before {
  top: 0;
  left: 0;
  width: 44%;
  height: 56%;
  background:
    linear-gradient(to right, transparent 38%, #fff 38% 62%, transparent 62%),
    linear-gradient(to bottom, transparent 38%, #fff 38% 62%, transparent 62%),
    #0d5eaf;
}

.flag-cn {
  background: #de2910;
}

.flag-cn::before {
  top: 4px;
  left: 5px;
  width: 10px;
  height: 10px;
  background: #ffde00;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 82% 100%, 50% 72%, 18% 100%, 31% 57%, 0 35%, 38% 35%);
}

.flag-jp {
  background: #fff;
}

.flag-jp::before {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #bc002d;
}

.flag-in {
  background: linear-gradient(to bottom, #ff9933 0 33.33%, #fff 33.33% 66.66%, #138808 66.66%);
}

.flag-in::before {
  width: 8px;
  height: 8px;
  border: 1.5px solid #000080;
  border-radius: 50%;
}

.flag-eg {
  background: linear-gradient(to bottom, #ce1126 0 33.33%, #fff 33.33% 66.66%, #000 66.66%);
}

.flag-eg::before {
  width: 4px;
  height: 7px;
  border-radius: 2px;
  background: #c09300;
}

.flag-al {
  background: #e41e20;
}

.flag-al::before {
  width: 12px;
  height: 12px;
  background: #1b1b1b;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 82% 100%, 50% 72%, 18% 100%, 31% 57%, 0 35%, 38% 35%);
}

.flag-ir {
  background: linear-gradient(to bottom, #239f40 0 33.33%, #fff 33.33% 66.66%, #da0000 66.66%);
}

.flag-ir::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #da0000;
}

.flag-ma {
  background: #c1272d;
}

.flag-ma::before {
  width: 11px;
  height: 11px;
  background: #006233;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 82% 100%, 50% 72%, 18% 100%, 31% 57%, 0 35%, 38% 35%);
}

.flag-za {
  background: linear-gradient(to bottom, #de3831 0 33%, #fff 33% 43%, #007a4d 43% 57%, #fff 57% 67%, #002395 67%);
}

.flag-za::before {
  left: 0;
  width: 48%;
  height: 100%;
  background: #000;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.flag-za::after {
  left: 0;
  width: 60%;
  height: 100%;
  background: #ffb612;
  clip-path: polygon(0 13%, 88% 50%, 0 87%, 0 72%, 52% 50%, 0 28%);
}

.flag-dk {
  background: #c60c30;
}

.flag-dk::before {
  top: 0;
  left: 30%;
  width: 11%;
  height: 100%;
  background: #fff;
}

.flag-dk::after {
  top: 42%;
  left: 0;
  width: 100%;
  height: 16%;
  background: #fff;
}

.flag-mx {
  background: linear-gradient(to right, #006847 0 33.33%, #fff 33.33% 66.66%, #ce1126 66.66%);
}

.flag-mx::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9c7a2e;
}

.flag-vn {
  background: #da251d;
}

.flag-vn::before {
  width: 12px;
  height: 12px;
  background: #ffcd00;
  clip-path: polygon(50% 0, 62% 35%, 100% 35%, 69% 57%, 82% 100%, 50% 72%, 18% 100%, 31% 57%, 0 35%, 38% 35%);
}

.flag-pk {
  background: linear-gradient(to right, #fff 0 25%, #01411c 25%);
}

.flag-pk::before {
  left: 58%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: -3px 0 0 0 #fff;
}

.flag-ve {
  background: linear-gradient(to bottom, #f4d03f 0 33.33%, #0033a0 33.33% 66.66%, #ef3340 66.66%);
}

.flag-ht {
  background: linear-gradient(to bottom, #00209f 0 50%, #d21034 50%);
}

.flag-tn {
  background: #e70013;
}

.flag-tn::before {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
}

.flag-tn::after {
  left: 51%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  box-shadow: -2px 0 0 0 #e70013;
}

.flag-unknown {
  background: linear-gradient(135deg, #eee 0 48%, #aaa 48% 52%, #eee 52%);
}

.description-country-flag.country-flag {
  display: inline-grid;
  width: 30px;
  min-width: 30px;
  max-width: 30px;
  height: 20px;
  min-height: 20px;
  max-height: 20px;
  margin-inline: 3px;
  border-radius: 4px;
  vertical-align: -5px;
}

.card-field {
  display: block;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cec1a8;
  border-radius: 7px;
  padding: 6px 8px;
  background: #fbf4dd;
  color: #42382d;
  font-size: 0.72rem;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-bar {
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
  margin-top: 0;
  padding-top: 4px;
}

.battle-status-row.boss-effect-visible ~ .synergy-list:empty:not(.reveal-mode) {
  display: none;
}

.battle-status-row ~ .card-table {
  flex: 1 1 clamp(290px, 44vh, 440px);
  height: auto;
  min-height: clamp(260px, 38vh, 400px);
}

.action-hint {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #e7785b;
  border-radius: 7px;
  padding: 0 10px;
  background-color: #341411;
  background-image: linear-gradient(180deg, #5a2019 0%, #341411 100%);
  color: #fff4d6;
  font-size: 0.86rem;
  font-weight: 1000;
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.58),
    inset 0 0 0 1px rgba(255, 218, 160, 0.12);
  text-shadow: 0 1px 1px #000;
  white-space: nowrap;
}

.play-action-control {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}

.play-action-control .action-hint {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 7px);
  z-index: 40;
  transform: translateX(-50%);
  pointer-events: none;
}

.primary-button.is-soft-disabled {
  cursor: not-allowed;
  filter: grayscale(0.65);
  opacity: 0.55;
  transform: none;
}

.primary-button.action-count-button.is-soft-disabled {
  filter: none;
}

.primary-button.is-soft-disabled:hover {
  border-color: transparent;
  transform: none;
}

.log-panel {
  flex: 0 0 auto;
  margin-top: 0;
}

.log-panel ol {
  display: grid;
  gap: 8px;
  max-height: 64px;
  margin: 0;
  overflow-y: auto;
  padding-left: 20px;
}

.log-panel li {
  color: #d9d2bc;
  line-height: 1.4;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.72);
}

#shopOverlay {
  place-items: stretch;
  padding: 0;
  background: var(--panel-2);
}

.modal-panel {
  width: min(980px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  padding: 18px;
  box-shadow: var(--shadow);
}

.shop-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  display: grid;
  grid-template-rows: auto auto minmax(min-content, 1fr) auto;
  align-content: stretch;
  border: 0;
  border-radius: 0;
  padding: clamp(12px, 1.8vw, 24px);
  box-shadow: none;
}

.shop-panel .modal-header {
  margin-bottom: 10px;
}

.shop-panel > .modal-header,
.shop-panel > .shop-money,
.shop-panel > .shop-grid {
  width: min(100%, 1600px);
  margin-inline: auto;
}

.modal-header {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.modal-header-actions,
.card-zone-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.modal-header-actions {
  min-width: 0;
}

.boss-reward-review-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.boss-reward-review-actions > button {
  min-height: 36px;
}

.card-zone-shortcuts > button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 0.88rem;
}

.card-zone-viewer-overlay {
  z-index: 220;
  padding: clamp(10px, 2vw, 22px);
  background: rgba(3, 4, 3, 0.9);
  backdrop-filter: blur(5px);
}

.card-zone-viewer-panel {
  display: grid;
  width: min(1320px, 100%);
  height: min(820px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.58);
}

.card-zone-viewer-panel > .modal-header {
  margin: 0;
}

.card-zone-viewer-tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  gap: 6px;
}

.card-zone-viewer-tabs > button {
  min-width: 92px;
}

.card-zone-viewer-tabs > button.is-selected,
.card-zone-viewer-tabs > button[aria-selected="true"] {
  border-color: var(--gold);
  color: #fff1bd;
  background: rgba(242, 193, 78, 0.14);
}

.card-zone-viewer-grid {
  min-height: 0;
  overflow-y: auto;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-content: start;
  padding: 4px 8px 12px 4px;
}

.card-zone-viewer-card.draw-pile-order-known {
  border-color: #f2c14e;
  box-shadow: 0 0 0 2px rgba(242, 193, 78, 0.22);
}

.draw-pile-positioned {
  position: relative;
}

.draw-pile-positioned::before {
  content: "#" attr(data-draw-position);
  position: absolute;
  z-index: 8;
  top: 7px;
  left: 7px;
  min-width: 2.15em;
  padding: 3px 7px;
  border: 1px solid rgba(255, 225, 137, 0.9);
  border-radius: 999px;
  background: rgba(35, 25, 8, 0.94);
  color: #ffe089;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.45);
}

/* During a round, draw and discard piles share one compact window over the table. */
.card-zone-viewer-overlay.round-card-zone-viewer {
  place-items: start center;
  padding: clamp(10px, 2vh, 20px) 14px 0 calc(clamp(230px, 15vw, 260px) + 26px);
  background: transparent;
  backdrop-filter: none;
  pointer-events: none;
}

/* Keep the in-run Legacy hover panel above the non-modal pile viewer. */
body:has(.card-zone-viewer-overlay.round-card-zone-viewer:not(.hidden)) .left-panel {
  z-index: 230;
}

.card-zone-viewer-overlay.round-card-zone-viewer .card-zone-viewer-panel {
  width: min(1320px, 100%);
  height: min(360px, calc(48vh - 20px));
  max-height: min(360px, calc(48vh - 20px));
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px 12px;
  pointer-events: auto;
}

.card-zone-viewer-overlay.round-card-zone-viewer .modal-header {
  display: none;
}

.card-zone-viewer-overlay.round-card-zone-viewer [data-card-zone-tab="hand"] {
  display: none;
}

.card-zone-viewer-overlay.round-card-zone-viewer .card-zone-viewer-tabs {
  flex: 0 0 auto;
}

.card-zone-viewer-overlay.round-card-zone-viewer .card-zone-viewer-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-top: 0;
}

.card-zone-viewer-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 32px 18px;
  border: 1px dashed rgba(242, 193, 78, 0.28);
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .card-zone-viewer-overlay.round-card-zone-viewer {
    padding-left: 14px;
  }

  .card-zone-viewer-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .modal-header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .card-zone-viewer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-zone-viewer-tabs {
    width: 100%;
  }

  .card-zone-viewer-tabs > button {
    min-width: 0;
    flex: 1;
  }
}

.game-over-overlay {
  z-index: 150;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(213, 87, 87, 0.16), transparent 38%),
    rgba(0, 0, 0, 0.92);
}

.game-over-panel {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100%;
  outline: none;
}

.game-over-panel h2 {
  margin: 0;
  color: #ff6b61;
  font-size: clamp(3.6rem, 11vw, 9rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 0.9;
  text-align: center;
  text-shadow:
    0 0 24px rgba(213, 87, 87, 0.48),
    0 18px 54px rgba(0, 0, 0, 0.78);
  animation: game-over-reveal calc(1100ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.18, 0.82, 0.2, 1) both;
}

.game-clear-overlay {
  background:
    radial-gradient(circle at 50% 50%, rgba(242, 193, 78, 0.2), transparent 38%),
    rgba(0, 0, 0, 0.92);
}

.game-clear-overlay .game-over-panel h2 {
  color: var(--gold);
  text-shadow:
    0 0 28px rgba(242, 193, 78, 0.52),
    0 18px 54px rgba(0, 0, 0, 0.78);
}

@keyframes game-over-reveal {
  0% { opacity: 0; transform: scale(1.18); filter: blur(8px); }
  34% { opacity: 1; transform: scale(0.98); filter: blur(0); }
  72% { opacity: 1; transform: scale(1); }
  100% { opacity: 0.9; transform: scale(1); }
}

#runEndOverlay {
  z-index: 150;
}

.run-end-panel {
  width: min(620px, 100%);
  display: grid;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  text-align: center;
  outline: none;
  animation: run-end-panel-enter calc(420ms * var(--game-speed-duration-scale, 1)) ease-out both;
}

/* Only the item presentation fills the window; XP/results keep their modal layout. */
#runEndOverlay:has(.has-unlock-details #runEndUnlocks:not(.hidden)) {
  padding: 0;
  background: #10110e;
}

#runEndPanel.has-unlock-details:has(#runEndUnlocks:not(.hidden)) {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  max-height: none;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 20px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: clamp(20px, 3vh, 40px) clamp(24px, 4vw, 72px);
  background:
    radial-gradient(ellipse at 28% 48%, rgba(255, 224, 112, 0.19), transparent 52%),
    radial-gradient(ellipse at 75% 52%, rgba(111, 78, 165, 0.13), transparent 58%),
    linear-gradient(145deg, #080907, #13140f 55%, #0a0b08);
  box-shadow: none;
  animation: none;
}

#runEndPanel.has-unlock-details:has(#runEndUnlocks:not(.hidden)) > :not(#runEndAnnouncement):not(#runEndUnlocks):not(#runEndUnlockActions) {
  display: none;
}

.run-end-panel.is-demo-pitch-visible {
  width: min(1120px, 100%);
}

.run-end-panel.is-demo-pitch-visible > :not(#runEndAnnouncement):not(#runEndDemoPitch) {
  display: none;
}

@keyframes run-end-panel-enter {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.run-end-header {
  display: grid;
  gap: 4px;
}

.run-end-header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.run-end-header h2 {
  color: var(--gold);
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.run-end-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.run-end-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 10px;
  background: #171812;
}

.run-end-summary span,
.run-end-unlocks span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.run-end-summary strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 1.45rem;
}

.run-end-xp-bar {
  position: relative;
  height: 22px;
  overflow: hidden;
  border: 2px solid rgba(242, 193, 78, 0.62);
  border-radius: 999px;
  background: #090a08;
  box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.58);
}

.run-end-xp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #d89435, #ffe15a 72%, #fff1a8),
    var(--gold);
  box-shadow:
    0 0 18px rgba(242, 193, 78, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.52);
  transition-property: width;
  transition-timing-function: cubic-bezier(0.22, 0.75, 0.2, 1);
}

.run-end-xp-bar.is-full {
  animation: run-end-xp-full calc(620ms * var(--game-speed-duration-scale, 1)) ease-out;
}

@keyframes run-end-xp-full {
  0%, 100% { box-shadow: inset 0 3px 10px rgba(0, 0, 0, 0.58); }
  45% { box-shadow: 0 0 34px rgba(255, 225, 90, 0.86), inset 0 0 12px rgba(255, 255, 255, 0.62); }
}

.run-end-level-up {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 92px;
  border: 1px solid rgba(242, 193, 78, 0.7);
  border-radius: 10px;
  padding: 12px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 225, 90, 0.25), transparent 64%),
    #171812;
  animation: run-end-level-up calc(760ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.16, 0.86, 0.22, 1) both;
}

.run-end-level-up > span {
  color: var(--gold);
  font-size: clamp(1.8rem, 6vw, 3rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1;
  text-shadow: 0 0 22px rgba(242, 193, 78, 0.58);
}

.run-end-level-up > strong {
  color: #fff;
  font-size: 1.1rem;
}

@keyframes run-end-level-up {
  0% { opacity: 0; transform: scale(0.72); }
  58% { opacity: 1; transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

.run-end-unlocks {
  --unlock-reveal-origin-x: 29%;
  --unlock-reveal-origin-y: 51%;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  min-height: 0;
}

.run-end-unlocks.is-entering {
  animation: run-end-unlocks-enter calc(980ms * var(--game-speed-duration-scale, 1)) ease-out both;
}

.run-end-unlocks > .run-end-unlock-heading {
  position: relative;
  z-index: 3;
  color: var(--gold);
  font-size: clamp(1.1rem, 2vw, 1.6rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-shadow: 0 0 22px rgba(255, 220, 93, 0.46);
}

.run-end-unlocks.is-feature-unlock .run-end-unlock-card {
  border-color: rgba(242, 193, 78, 0.78);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 225, 90, 0.16), transparent 42%),
    #171812;
  box-shadow: 0 0 24px rgba(242, 193, 78, 0.14);
}

@keyframes run-end-unlocks-enter {
  0% { opacity: 0; }
  9%, 100% { opacity: 1; }
}

.run-end-unlocks strong {
  color: var(--text);
  font-size: 1rem;
}

.run-end-unlocks-list {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-auto-rows: minmax(min-content, 1fr);
  gap: 10px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 4px 4px;
  scrollbar-gutter: stable;
}

.run-end-unlock-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(24px, 4vw, 72px);
  align-items: center;
  min-width: 0;
  min-height: 100%;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.34);
  border-radius: 16px;
  padding: clamp(16px, 2.5vw, 32px);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.1), transparent 56%),
    #12130f;
  text-align: left;
  width: 100%;
  margin-inline: auto;
  box-shadow:
    0 0 0 1px rgba(255, 235, 156, 0.08),
    0 26px 74px rgba(0, 0, 0, 0.54),
    0 0 52px rgba(242, 193, 78, 0.12);
  transform-origin: 50% 65%;
}

.run-end-unlock-card::before {
  position: absolute;
  z-index: -1;
  inset: 6px;
  border: 1px solid rgba(255, 224, 117, 0.58);
  border-radius: 12px;
  box-shadow:
    0 0 24px rgba(255, 218, 91, 0.3),
    inset 0 0 22px rgba(255, 231, 143, 0.08);
  content: "";
  pointer-events: none;
}

.run-end-unlock-card::after {
  position: absolute;
  z-index: 4;
  top: -42%;
  bottom: -42%;
  left: -46%;
  width: 22%;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 251, 222, 0.88), transparent);
  content: "";
  pointer-events: none;
  transform: rotate(15deg);
}

.run-end-unlock-new-badge {
  position: absolute;
  z-index: 5;
  top: clamp(12px, 1.7vw, 22px);
  left: clamp(12px, 1.7vw, 22px);
  display: inline-grid !important;
  min-width: 66px;
  place-items: center;
  border: 1px solid #fff0a6;
  border-radius: 999px;
  padding: 6px 13px 5px;
  color: #211806 !important;
  background: linear-gradient(180deg, #fff7c9, #f2c14e 72%, #c88924);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.38), 0 0 22px rgba(255, 221, 93, 0.56);
  font-size: 0.82rem !important;
  font-weight: 1000 !important;
  letter-spacing: 0.12em;
  line-height: 1;
  text-shadow: 0 1px rgba(255, 255, 255, 0.48);
}

.run-end-unlock-reveal-fx {
  position: absolute;
  z-index: 0;
  inset: -12px;
  overflow: hidden;
  pointer-events: none;
}

.run-end-unlock-reveal-fx::before {
  position: absolute;
  top: var(--unlock-reveal-origin-y);
  left: var(--unlock-reveal-origin-x);
  width: min(102vmin, 1080px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  background: repeating-conic-gradient(
    from -4deg,
    rgba(255, 230, 137, 0.34) 0deg 1.5deg,
    transparent 1.5deg 9deg
  );
  content: "";
  transform: translate(-50%, -50%);
}

.run-end-unlock-reveal-fx::after {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at var(--unlock-reveal-origin-x) var(--unlock-reveal-origin-y), rgba(255, 255, 235, 0.96) 0 2%, rgba(255, 222, 103, 0.52) 7%, transparent 34%);
  content: "";
}

.run-end-unlock-spark {
  position: absolute;
  top: var(--unlock-reveal-origin-y);
  left: var(--unlock-reveal-origin-x);
  width: clamp(4px, 0.45vmin, 8px);
  height: clamp(4px, 0.45vmin, 8px);
  border-radius: 50%;
  opacity: 0;
  background: #fff8c9;
  box-shadow: 0 0 10px #fff4b0, 0 0 20px #f2c14e;
}

.run-end-unlocks.is-entering .run-end-unlock-reveal-fx::before {
  animation: run-end-unlock-rays calc(1300ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.16, 0.82, 0.22, 1) both;
}

.run-end-unlocks.is-entering .run-end-unlock-reveal-fx::after {
  animation: run-end-unlock-flash calc(760ms * var(--game-speed-duration-scale, 1)) ease-out both;
}

.run-end-unlocks.is-entering .run-end-unlock-spark {
  animation: run-end-unlock-spark calc(920ms * var(--game-speed-duration-scale, 1)) ease-out var(--spark-delay) both;
}

.run-end-unlocks.is-entering .run-end-unlock-card {
  animation: run-end-unlock-card-reveal calc(980ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.14, 0.86, 0.2, 1) both;
}

.run-end-unlocks.is-entering .run-end-unlock-card::before {
  animation: run-end-unlock-border-pulse calc(1100ms * var(--game-speed-duration-scale, 1)) ease-out both;
}

.run-end-unlocks.is-entering .run-end-unlock-card::after {
  animation: run-end-unlock-card-shine calc(820ms * var(--game-speed-duration-scale, 1)) ease-out calc(190ms * var(--game-speed-duration-scale, 1)) both;
}

.run-end-unlocks.is-entering .run-end-unlock-visual {
  animation: run-end-unlock-visual-reveal calc(860ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.17, 0.84, 0.24, 1) both;
}

.run-end-unlocks.is-entering .run-end-unlock-new-badge {
  animation: run-end-unlock-badge calc(460ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.16, 0.9, 0.28, 1.25) calc(500ms * var(--game-speed-duration-scale, 1)) both;
}

.run-end-unlocks.is-entering > .run-end-unlock-heading,
.run-end-unlocks.is-entering .run-end-unlock-copy > * {
  animation: run-end-unlock-copy-reveal calc(480ms * var(--game-speed-duration-scale, 1)) ease-out calc(470ms * var(--game-speed-duration-scale, 1)) both;
}

#runEndPanel:has(#runEndUnlocks.is-entering:not(.hidden)) #runEndUnlockActions:not(.hidden) .primary-button {
  animation: run-end-unlock-next-reveal calc(380ms * var(--game-speed-duration-scale, 1)) ease-out calc(720ms * var(--game-speed-duration-scale, 1)) both;
}

@keyframes run-end-unlock-flash {
  0% { opacity: 0; filter: brightness(1); }
  12% { opacity: 1; filter: brightness(1.8); }
  42% { opacity: 0.58; }
  100% { opacity: 0; filter: brightness(1); }
}

@keyframes run-end-unlock-rays {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.24) rotate(-28deg); }
  24% { opacity: 0.78; }
  100% { opacity: 0.2; transform: translate(-50%, -50%) scale(1.08) rotate(5deg); }
}

@keyframes run-end-unlock-spark {
  0% { opacity: 0; transform: rotate(var(--spark-angle)) translateY(0) scale(0.2); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--spark-angle)) translateY(calc(0px - var(--spark-distance))) scale(1.15); }
}

@keyframes run-end-unlock-card-reveal {
  0% { opacity: 0; filter: brightness(2.1) blur(7px); transform: translateY(38px) scale(0.62); }
  19% { opacity: 1; filter: brightness(1.65) blur(2px); }
  56% { filter: brightness(1.08) blur(0); transform: translateY(-8px) scale(1.045); }
  76% { transform: translateY(3px) scale(0.987); }
  100% { opacity: 1; filter: brightness(1) blur(0); transform: translateY(0) scale(1); }
}

@keyframes run-end-unlock-border-pulse {
  0% { opacity: 0; transform: scale(0.72); }
  34% { opacity: 1; }
  68% { box-shadow: 0 0 50px rgba(255, 224, 109, 0.62), inset 0 0 28px rgba(255, 239, 174, 0.16); }
  100% { opacity: 0.72; transform: scale(1); }
}

@keyframes run-end-unlock-card-shine {
  0% { left: -46%; opacity: 0; }
  18% { opacity: 0.9; }
  100% { left: 128%; opacity: 0; }
}

@keyframes run-end-unlock-visual-reveal {
  0%, 16% { filter: brightness(2.4) saturate(0.2); transform: scale(0.84); }
  48% { filter: brightness(1.25) saturate(1.18); transform: scale(1.035); }
  100% { filter: brightness(1) saturate(1); transform: scale(1); }
}

@keyframes run-end-unlock-badge {
  0% { opacity: 0; transform: translate(-14px, -9px) rotate(-13deg) scale(1.65); }
  70% { opacity: 1; transform: translate(0, 0) rotate(2deg) scale(0.94); }
  100% { opacity: 1; transform: rotate(0) scale(1); }
}

@keyframes run-end-unlock-copy-reveal {
  from { opacity: 0; transform: translateX(22px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes run-end-unlock-next-reveal {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.run-end-unlock-actions {
  display: flex;
  justify-content: center;
}

.run-end-unlock-actions .primary-button {
  min-width: 220px;
  min-height: 54px;
  font-size: 1.1rem;
}

.run-end-unlock-visual {
  display: grid !important;
  place-items: center;
  justify-self: center;
  width: min(100%, 42vh, 400px);
  aspect-ratio: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.4);
  border-radius: 16px;
  background:
    radial-gradient(circle, rgba(242, 193, 78, 0.15), transparent 72%),
    #090a08;
  color: var(--gold);
  font-size: clamp(6rem, 18vh, 14rem) !important;
  line-height: 1;
}

.run-end-unlock-visual.has-image {
  width: min(100%, 50vh, 480px);
  aspect-ratio: 3 / 4;
}

.run-end-unlock-visual img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
}

.run-end-unlock-copy {
  display: grid;
  min-width: 0;
  gap: 12px;
  align-content: start;
}

.run-end-unlock-kind {
  color: var(--gold) !important;
  font-size: 1rem !important;
  font-weight: 900 !important;
  letter-spacing: 0.08em;
}

.run-end-unlock-name {
  display: block;
  overflow-wrap: normal;
  color: var(--text) !important;
  font-size: clamp(1.8rem, 3.1vw, 3.8rem) !important;
  line-height: 1.3;
}

.run-end-unlock-name .enhanced-card-name-plus {
  display: inline-flex;
  color: var(--gold);
  font-size: 0.8em;
}

.run-end-unlock-meta {
  display: block;
  color: var(--muted);
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  line-height: 1.5;
}

.run-end-unlock-effect {
  display: grid;
  min-width: 0;
  gap: 8px;
  margin-top: 4px;
  border-left: 3px solid rgba(242, 193, 78, 0.82);
  border-radius: 0 7px 7px 0;
  padding: 14px 18px;
  background: rgba(242, 193, 78, 0.08);
}

.run-end-unlock-effect > .run-end-unlock-effect-label {
  color: var(--gold);
  font-size: 0.9rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.run-end-unlock-description {
  margin: 4px 0 0;
  color: #f3edd9;
  font-size: clamp(1.05rem, 1.4vw, 1.5rem);
  font-weight: 700;
  line-height: 1.55;
  overflow-wrap: normal;
}

.run-end-unlock-effect > .run-end-unlock-description {
  margin-top: 0;
}

@media (max-width: 700px) {
  #runEndPanel.has-unlock-details:has(#runEndUnlocks:not(.hidden)) {
    gap: 12px;
    padding: 16px;
  }

  .run-end-unlock-card {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    align-content: center;
    padding: 20px;
  }

  .run-end-unlocks {
    --unlock-reveal-origin-x: 50%;
    --unlock-reveal-origin-y: 34%;
  }

  .run-end-unlock-visual,
  .run-end-unlock-visual.has-image {
    width: min(100%, 28vh, 180px);
    font-size: 6rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .run-end-unlocks.is-entering,
  .run-end-unlocks.is-entering .run-end-unlock-reveal-fx::before,
  .run-end-unlocks.is-entering .run-end-unlock-reveal-fx::after,
  .run-end-unlocks.is-entering .run-end-unlock-spark,
  .run-end-unlocks.is-entering .run-end-unlock-card,
  .run-end-unlocks.is-entering .run-end-unlock-card::before,
  .run-end-unlocks.is-entering .run-end-unlock-card::after,
  .run-end-unlocks.is-entering .run-end-unlock-visual,
  .run-end-unlocks.is-entering .run-end-unlock-new-badge,
  .run-end-unlocks.is-entering > .run-end-unlock-heading,
  .run-end-unlocks.is-entering .run-end-unlock-copy > *,
  #runEndPanel:has(#runEndUnlocks.is-entering:not(.hidden)) #runEndUnlockActions:not(.hidden) .primary-button {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }
}

.demo-pitch {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(242, 193, 78, 0.48);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(242, 193, 78, 0.2), transparent 42%),
    linear-gradient(135deg, rgba(242, 193, 78, 0.12), rgba(89, 58, 121, 0.18)),
    #11120e;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.demo-pitch-continuation-banner {
  display: grid;
  justify-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 225, 122, 0.58);
  border-radius: 10px;
  padding: 14px clamp(12px, 3vw, 28px);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.18), rgba(89, 58, 121, 0.18)),
    rgba(8, 9, 7, 0.88);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
}

.demo-pitch-continuation-banner h2 {
  margin: 0 0 3px;
  color: #fff0b1;
  font-size: clamp(1.7rem, 4vw, 2.65rem);
  line-height: 1.15;
  text-shadow: 0 0 22px rgba(242, 193, 78, 0.26);
}

.demo-pitch-continuation-banner p {
  max-width: 62ch;
  margin: 0;
  color: #f4ecd5;
  font-size: clamp(0.88rem, 1.7vw, 1.05rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.demo-pitch-heading {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.demo-pitch-heading > strong {
  color: var(--gold);
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
}

.demo-pitch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.demo-pitch-feature {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.3);
  border-radius: 10px;
  background: rgba(8, 9, 7, 0.88);
  text-align: left;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.26);
}

.demo-pitch-visual {
  position: relative;
  display: block;
  height: 126px;
  margin: 0;
  overflow: hidden;
  border-bottom: 1px solid rgba(242, 193, 78, 0.24);
  background:
    radial-gradient(circle at 50% 28%, rgba(242, 193, 78, 0.16), transparent 56%),
    #191a14;
}

.demo-pitch-visual img {
  position: absolute;
  display: block;
  object-fit: cover;
  object-position: center top;
}

.demo-pitch-card-fan img {
  top: 8px;
  width: 78px;
  height: 108px;
  border: 2px solid #e8dcb9;
  border-radius: 5px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.58);
}

.demo-pitch-card-fan img:nth-of-type(1) {
  left: calc(50% - 94px);
  transform: rotate(-8deg);
}

.demo-pitch-card-fan img:nth-of-type(2) {
  z-index: 2;
  left: calc(50% - 39px);
}

.demo-pitch-card-fan img:nth-of-type(3) {
  left: calc(50% + 16px);
  transform: rotate(8deg);
}

.demo-pitch-count,
.demo-pitch-boss-label {
  position: absolute;
  z-index: 4;
  right: 10px;
  bottom: 9px;
  border: 1px solid rgba(255, 225, 122, 0.76);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(11, 10, 7, 0.9);
  color: #ffe17a;
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.06em;
}

.demo-pitch-single-card > img {
  inset: 7px auto 7px 16px;
  width: 84px;
  height: 112px;
  object-fit: contain;
  object-position: center;
  border: 1px solid rgba(255, 238, 184, 0.6);
  border-radius: 5px;
  background: #090a08;
  filter: saturate(0.9) contrast(1.05);
  box-shadow: 0 7px 16px rgba(0, 0, 0, 0.5);
}

.demo-pitch-single-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 26%, rgba(5, 6, 5, 0.14) 42%, rgba(5, 6, 5, 0.84) 78%);
  pointer-events: none;
}

.demo-pitch-emblem,
.demo-pitch-event-sheet,
.demo-pitch-tool {
  position: absolute;
  z-index: 3;
  right: 18px;
  top: 16px;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(255, 225, 122, 0.75);
  border-radius: 10px;
  background: rgba(17, 14, 8, 0.88);
  color: #ffe17a;
  font-size: 1.6rem;
  font-weight: 1000;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.42);
}

.demo-pitch-event-sheet {
  width: 66px;
  height: 48px;
  border-radius: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
}

.demo-pitch-ribbon {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: 12px;
  max-width: 62%;
  border-left: 3px solid var(--gold);
  padding: 4px 7px;
  background: rgba(8, 9, 7, 0.86);
  color: #fff5d5;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.25;
}

.demo-pitch-mark-heart {
  position: absolute;
  z-index: 4;
  left: 43%;
  top: 39%;
  color: #ff4f7b;
  font-size: 2.15rem;
  line-height: 1;
  transform: rotate(-10deg);
  text-shadow:
    0 2px 1px rgba(62, 4, 20, 0.78),
    0 0 8px rgba(255, 79, 123, 0.72);
}

.demo-pitch-workshop-card > img {
  filter: grayscale(0.2) brightness(0.65);
}

.demo-pitch-workshop-grid {
  position: absolute;
  z-index: 2;
  inset: 14px auto 14px 112px;
  width: 92px;
  border: 1px dashed rgba(255, 238, 184, 0.82);
  border-radius: 5px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 12px 12px;
}

.demo-pitch-tool {
  font-size: 1.8rem;
}

.demo-pitch-import-badge {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: 14px;
  border: 1px solid rgba(255, 225, 122, 0.7);
  border-radius: 999px;
  padding: 4px 8px;
  background: rgba(17, 14, 8, 0.9);
  color: #ffe17a;
  font-size: 0.68rem;
  font-weight: 900;
}

.demo-pitch-boss-fan {
  background: radial-gradient(circle at 50% 30%, rgba(162, 54, 54, 0.4), transparent 58%), #160d0d;
}

.demo-pitch-boss-fan img {
  border-color: #9e4842;
}

.demo-pitch-boss-label {
  border-color: rgba(255, 106, 90, 0.78);
  color: #ff978b;
}

.demo-pitch-feature-copy {
  display: grid;
  gap: 5px;
  padding: 11px 12px 13px;
}

.demo-pitch-feature-copy > strong {
  color: var(--gold);
  font-size: 0.95rem;
}

.demo-pitch-feature-copy > p {
  margin: 0;
  color: #e5dfcd;
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .demo-pitch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .demo-pitch {
    padding: 12px;
  }

  .demo-pitch-grid {
    grid-template-columns: 1fr;
  }
}

.fatal-error-panel {
  border-color: rgba(222, 92, 92, 0.65);
}

.fatal-error-panel h2 {
  color: #ffb0a8;
}

.shop-money {
  margin-bottom: 10px;
}

.shop-money strong {
  color: var(--gold);
  font-size: 1.2rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: space-evenly;
  gap: 12px;
}

.shop-grid > section {
  min-width: 0;
}

.shop-event-section {
  display: grid;
  width: 100%;
  grid-template-rows: auto minmax(0, 1fr);
}

.shop-items {
  display: grid;
  gap: 8px;
}

.shop-person-items {
  grid-template-columns: repeat(3, minmax(0, 348px));
  justify-content: space-between;
}

.shop-event-items {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
}

.shop-people-section {
  width: 100%;
  justify-self: center;
}

.shop-services {
  display: grid;
  width: 100%;
  margin-top: 10px;
  justify-items: center;
}

.shop-service-items {
  width: min(100%, 560px);
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.shop-service-items .shop-service-item {
  width: 100%;
  min-height: 62px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: center;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.shop-service-items .shop-service-item h3 {
  align-self: center;
}

.shop-service-items .shop-service-item .shop-item-footer {
  align-self: center;
}

.shop-service-items .shop-service-item .price-button {
  min-height: 38px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shop-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #171812;
}

.shop-item h3 {
  margin: 0;
  color: var(--gold);
  font-size: 1rem;
}

.shop-item p {
  font-size: 0.9rem;
}

.shop-card-layout {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-width: 0;
}

.shop-offer-item {
  min-height: 220px;
  height: auto;
}

.shop-event-item {
  grid-template-rows: auto minmax(min-content, 1fr) auto;
  border-color: rgba(102, 197, 210, 0.4);
  background:
    linear-gradient(145deg, rgba(68, 166, 184, 0.08), transparent 58%),
    #171812;
}

.shop-event-item h3 {
  color: #b8edf1;
}

.shop-event-item .shop-item-kind {
  border-color: rgba(102, 197, 210, 0.38);
  background: rgba(68, 166, 184, 0.1);
  color: #aee6eb;
}

.shop-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  border: 1px dashed rgba(183, 178, 158, 0.26);
  border-radius: 10px;
  color: var(--muted);
  font-weight: 800;
}

.shop-service-item {
  align-content: space-between;
}

.shop-card-item {
  min-height: 168px;
  align-content: start;
  gap: 6px;
  padding: 10px;
}

.shop-grid .shop-card-item {
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 148px;
  gap: 4px;
  padding: 8px;
}

.shop-grid .shop-card-layout {
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
}

.shop-grid .shop-card-portrait {
  width: 68px;
}

.shop-grid .shop-card-copy {
  gap: 4px;
}

.shop-grid .shop-card-item .shop-item-footer .price-button {
  min-height: 38px;
}

.shop-card-portrait {
  position: relative;
  display: grid;
  width: 76px;
  aspect-ratio: 3 / 4;
  place-items: center;
  overflow: hidden;
  border: 1px solid #5d5541;
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.2), transparent 42%),
    var(--accent, #8b6f47);
}

.shop-card-portrait img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.shop-card-initials {
  position: absolute;
  z-index: 1;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: rgba(18, 18, 14, 0.34);
  color: white;
  font-weight: 1000;
}

.shop-card-portrait.image-loaded .shop-card-initials {
  display: none;
}

.shop-card-copy {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.shop-card-item-enhanced {
  position: relative;
  isolation: isolate;
  border: 2px solid rgba(255, 220, 121, 0.95);
  background:
    linear-gradient(135deg, rgba(255, 222, 126, 0.12), transparent 42%, rgba(255, 238, 181, 0.08)),
    var(--panel-2);
  box-shadow:
    inset 0 0 22px rgba(255, 211, 91, 0.16),
    0 0 0 1px rgba(255, 239, 185, 0.28),
    0 0 24px rgba(242, 193, 78, 0.38);
}

.shop-card-item-enhanced::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 0;
  border: 1px solid rgba(255, 244, 209, 0.5);
  border-radius: calc(var(--radius) - 3px);
  pointer-events: none;
}

.shop-card-item-enhanced > * {
  position: relative;
  z-index: 1;
}

.shop-card-copy h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.shop-card-status {
  margin-top: 2px;
}

.shop-card-status .card-fields {
  flex: 0 1 auto;
  width: fit-content;
  max-width: 100%;
}

.shop-card-status .card-fields .card-field {
  flex: 0 1 auto;
  width: max-content;
  min-width: 3.5em;
  padding-inline: 10px;
}

.shop-item-footer {
  display: flex;
  align-items: center;
  align-self: end;
  justify-content: space-between;
  gap: 12px;
}

.shop-item-footer .price-button {
  min-width: 92px;
  margin-left: auto;
}

@media (min-width: 1200px) and (min-height: 800px) {
  .shop-panel {
    grid-template-rows: auto auto auto auto;
    align-content: center;
    padding: clamp(18px, 1.5vw, 26px);
  }

  .shop-panel > .modal-header,
  .shop-panel > .shop-money,
  .shop-panel > .shop-grid {
    width: min(100%, 1680px);
  }

  .shop-panel .modal-header {
    margin-bottom: 8px;
  }

  .shop-panel .modal-header h2 {
    font-size: clamp(1.9rem, 2vw, 2.35rem);
  }

  .shop-panel .modal-header p {
    margin-top: 6px;
    font-size: 1.02rem;
  }

  .shop-panel .modal-actions {
    gap: 8px;
  }

  .shop-panel .modal-actions .secondary-button {
    min-height: 44px;
    padding-inline: 16px;
    font-size: 1rem;
  }

  .shop-money {
    margin-bottom: 8px;
    font-size: 0.95rem;
  }

  .shop-money strong {
    margin-left: 4px;
    font-size: 1.55rem;
  }

  .shop-grid {
    grid-template-rows: 285px 275px;
    align-content: start;
    gap: 12px;
  }

  .shop-people-section,
  .shop-event-section {
    display: grid;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .shop-panel .section-heading {
    margin-bottom: 6px;
    font-size: 0.9rem;
  }

  .shop-person-items {
    height: 100%;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    gap: 12px;
  }

  .shop-grid .shop-card-item {
    min-height: 0;
    height: 100%;
    gap: 10px;
    border-radius: 10px;
    padding: 14px;
  }

  .shop-grid .shop-card-layout {
    height: 100%;
    min-height: 0;
    grid-template-columns: minmax(0, 62%) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
    align-content: stretch;
  }

  .shop-grid .shop-card-portrait {
    width: min(100%, clamp(190px, 18vw, 360px));
    height: auto;
    max-height: 100%;
    justify-self: start;
    align-self: center;
  }

  .shop-grid .shop-card-copy {
    gap: 8px;
  }

  .shop-card-copy h3 {
    font-size: 1.3rem;
    line-height: 1.25;
  }

  .shop-card-status .card-fields .card-field {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .shop-grid .shop-card-item .shop-item-footer .price-button {
    min-width: 124px;
    min-height: 52px;
    padding-inline: 18px;
    font-size: 1.1rem;
  }

  .shop-event-section > .shop-items {
    height: 100%;
    gap: 12px;
  }

  .shop-event-item {
    min-height: 0;
    height: 100%;
    gap: 8px;
    border-radius: 10px;
    padding: 14px 16px;
  }

  .shop-event-item .shop-item-kind,
  .shop-event-item .event-timing-badge {
    padding: 4px 9px;
    font-size: 0.76rem;
  }

  .shop-services {
    margin-top: 10px;
  }

  .shop-service-items {
    width: min(100%, 900px);
    gap: 12px;
  }

  .shop-service-items .shop-service-item {
    min-height: 72px;
    gap: 10px;
    border-radius: 10px;
    padding: 10px 12px;
  }

  .shop-service-items .shop-service-item h3 {
    font-size: 1.08rem;
  }

  .shop-service-items .shop-service-item .price-button {
    min-width: 126px;
    min-height: 48px;
    padding-inline: 18px;
    font-size: 1.03rem;
  }
}

/* Chronicle-themed cursors keep actions readable without obscuring card art. */
:where(
  button:not(:disabled),
  a[href],
  select:not(:disabled),
  summary,
  [role="button"]:not([aria-disabled="true"]),
  [role="tab"]:not([aria-disabled="true"]),
  input[type="checkbox"]:not(:disabled),
  input[type="radio"]:not(:disabled),
  input[type="range"]:not(:disabled),
  input[type="color"]:not(:disabled),
  input[type="file"]:not(:disabled),
  .person-card:not(.disabled):not(.event-participant-card),
  .deck-marking-card:not(:disabled)
) {
  cursor: var(--cursor-default);
}

:where(
  button:disabled,
  select:disabled,
  [aria-disabled="true"],
  input:disabled
) {
  cursor: var(--cursor-disabled);
}

:where(
  .person-card.event-participant-card,
  .person-card.disabled.deal-staged,
  body.discard-guidance-visible #discardButton:disabled
) {
  cursor: var(--cursor-default);
}

:where(
  article.has-card-enhancement-tooltip,
  .legacy-list > .legacy-slot.has-memory-targets
) {
  cursor: var(--cursor-help);
}

@media (min-width: 1500px) and (min-height: 800px) {
  .shop-grid .shop-card-item {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
  }

  .shop-grid .shop-card-layout {
    grid-column: 1;
    grid-row: 1;
    height: 100%;
  }

  .shop-grid .shop-card-item .shop-item-footer {
    grid-column: 1;
    grid-row: 2;
    align-self: end;
  }
}

.codex-panel {
  width: min(1100px, 100%);
}

.codex-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(183, 178, 158, 0.2);
}

.codex-tab {
  min-width: 104px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  background: #11120f;
  color: var(--muted);
  font-weight: 900;
}

.codex-tab.is-active {
  border-color: rgba(242, 193, 78, 0.62);
  background: rgba(242, 193, 78, 0.12);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.08);
}

#deckOverlay.draw-pile-overlay {
  place-items: start center;
  padding-top: clamp(12px, 2.5vh, 24px);
}

#deckOverlay.draw-pile-overlay .codex-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: clamp(260px, 38vh, 390px);
  max-height: clamp(260px, 38vh, 390px);
  overflow: hidden;
}

#deckOverlay.draw-pile-overlay .deck-grid {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

#deckOverlay.deck-removal-overlay .codex-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

#deckOverlay.deck-removal-overlay .deck-grid {
  min-height: 0;
  max-height: none;
  overflow-y: auto;
}

#deckOverlay.draw-pile-overlay .codex-card.draw-pile-order-known {
  border-color: #f2c14e;
  box-shadow:
    inset 0 0 0 1px rgba(242, 193, 78, 0.32),
    0 0 12px rgba(242, 193, 78, 0.2);
}

.codex-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.codex-grid.codex-system-grid {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
}

.codex-system-card {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 8px;
  min-height: 176px;
  border: 1px solid rgba(242, 193, 78, 0.34);
  border-radius: 9px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.055), transparent 56%),
    #171812;
}

.codex-system-card.codex-event-card {
  border-color: rgba(102, 197, 210, 0.4);
  background:
    linear-gradient(145deg, rgba(68, 166, 184, 0.09), transparent 56%),
    #171812;
}

.codex-system-card.codex-chronicle-card {
  border-color: rgba(188, 139, 255, 0.46);
  background:
    linear-gradient(145deg, rgba(119, 71, 179, 0.16), transparent 58%),
    #171812;
}

.codex-chronicle-card .codex-chronicle-heading em,
.codex-chronicle-card .codex-chronicle-heading span {
  border-color: rgba(188, 139, 255, 0.42);
  color: #ddbdff;
}

.codex-chronicle-people {
  color: #e5dded !important;
  line-height: 1.45;
}

.codex-system-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.codex-system-card-heading em,
.codex-system-card-heading span {
  display: inline-flex;
  width: fit-content;
  margin: 0;
  border: 1px solid rgba(242, 193, 78, 0.3);
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--gold);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
}

.codex-event-card .codex-system-card-heading em,
.codex-event-card .codex-system-card-heading span {
  border-color: rgba(102, 197, 210, 0.34);
  color: #b8edf1;
}

.codex-legacy-card .codex-legacy-icon {
  display: grid;
  flex: 0 0 74px;
  width: 74px;
  height: 74px;
  place-items: center;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.52);
  border-radius: 16px;
  padding: 0;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.2), rgba(242, 193, 78, 0.06)),
    #151610;
  color: #fff0b1;
  font-size: 2.75rem;
  line-height: 1;
  box-shadow: inset 0 0 22px rgba(242, 193, 78, 0.1);
}

.codex-system-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
}

.codex-system-card small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

.codex-system-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.codex-boss-card {
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 232px;
  border-color: rgba(255, 97, 78, 0.52);
  background:
    linear-gradient(145deg, rgba(130, 29, 24, 0.2), transparent 58%),
    #171812;
}

.codex-boss-portrait {
  grid-column: 1;
  grid-row: 1 / 4;
  width: 88px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent, #8b6f47) 68%, #fff 12%);
  border-radius: 8px;
  background: var(--accent, #8b6f47);
}

.codex-boss-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.codex-boss-card .codex-boss-heading,
.codex-boss-card > h3,
.codex-boss-card > .codex-boss-status {
  grid-column: 2;
}

.codex-boss-card > h3 {
  color: #fff3e7;
}

.codex-boss-card .codex-boss-heading em,
.codex-boss-card .codex-boss-heading span {
  border-color: rgba(255, 97, 78, 0.48);
  color: #ff9f8e;
}

.codex-boss-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.codex-boss-status .country-flag,
.codex-boss-status .card-field {
  margin-top: 0;
}

.codex-boss-ability {
  grid-column: 1 / -1;
  display: grid;
  align-content: start;
  gap: 5px;
  border-top: 1px solid rgba(255, 97, 78, 0.24);
  padding-top: 9px;
}

.codex-boss-ability > strong {
  color: #ffbd73;
  font-size: 0.9rem;
}

.codex-boss-card .codex-system-description {
  color: #f1efe4;
  font-weight: 700;
}

.codex-empty-state {
  grid-column: 1 / -1;
  margin: 0;
  border: 1px dashed rgba(183, 178, 158, 0.34);
  border-radius: 9px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.codex-system-card-locked {
  min-height: 132px;
  opacity: 0.62;
  border-style: dashed;
}

.deck-grid {
  max-height: min(560px, calc(100vh - 190px));
  overflow-y: auto;
  padding-right: 4px;
}

.deck-enhancement-grid {
  grid-auto-rows: 1fr;
}

.codex-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #171812;
}

.codex-card.boss-penalty-card,
.legacy-choice-card.boss-penalty-card {
  border-color: rgba(210, 69, 93, 0.86);
  background:
    linear-gradient(145deg, rgba(54, 13, 22, 0.98), rgba(20, 10, 13, 0.99)),
    #180b0f;
}

.codex-card.boss-debuff-card,
.legacy-choice-card.boss-debuff-card,
.legacy-choice-option.boss-debuff-card {
  border-color: rgba(164, 103, 209, 0.88);
  background:
    linear-gradient(145deg, rgba(48, 24, 68, 0.98), rgba(16, 9, 24, 0.99)),
    #120a1b;
}

.codex-card.boss-penalty-card > strong,
.legacy-choice-card.boss-penalty-card > strong {
  color: #fff3f5;
}

.codex-card.boss-penalty-card .codex-card-portrait,
.legacy-choice-card.boss-penalty-card .legacy-choice-portrait {
  border-color: rgba(255, 111, 134, 0.72);
}

.codex-card .boss-penalty-value,
.legacy-choice-card .boss-penalty-value {
  font-size: clamp(1.3rem, 2vw, 2rem);
}

.codex-card-portrait {
  position: relative;
  grid-row: 1 / 3;
  display: grid;
  width: 54px;
  aspect-ratio: 3 / 4;
  place-items: center;
  overflow: hidden;
  border: 1px solid #5d5541;
  border-radius: 7px;
  background: var(--accent, #8b6f47);
}

.codex-card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.codex-card strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-card .codex-card-empty-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.codex-card .card-status {
  display: flex;
  margin-top: 0;
}

.codex-history-button {
  grid-column: 1 / -1;
  min-height: 32px;
  margin-top: 2px;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.codex-card .codex-enhancement-title,
.codex-card .deck-enhancement-ability-name {
  grid-column: 1 / -1;
  margin-top: 2px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.4;
}

.codex-card .codex-enhancement-description,
.codex-card .deck-enhancement-ability-description {
  grid-column: 1 / -1;
  margin: 0;
  color: #f1efe4;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.5;
  text-wrap: pretty;
}

.person-history-panel {
  width: min(760px, 100%);
}

.person-history-header {
  align-items: flex-start;
}

.person-history-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.45;
}

.person-history-body {
  display: grid;
  grid-template-columns: minmax(130px, 180px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.person-history-portrait {
  display: block;
  overflow: hidden;
  border: 1px solid #5d5541;
  border-radius: 9px;
  background: #11120e;
  aspect-ratio: 3 / 4;
}

.person-history-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.person-history-copy {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 4px 0;
}

.person-history-copy p {
  color: #fff;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.8;
  text-wrap: pretty;
}

@media (max-width: 620px) {
  .person-history-body {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 14px;
  }

  .shop-service-items {
    width: min(100%, 280px);
    grid-template-columns: 1fr;
  }
}

/* Shop inventory stays above the shop and keeps both item categories visible. */
#shopInventoryOverlay {
  z-index: 220;
  padding: clamp(10px, 2vw, 22px);
  background: rgba(3, 4, 3, 0.9);
  backdrop-filter: blur(5px);
}

.shop-inventory-panel {
  display: grid;
  width: min(1240px, 100%);
  height: min(760px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.58);
}

.shop-inventory-panel > .modal-header {
  margin: 0;
}

.shop-inventory-sections {
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.shop-inventory-section {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border: 1px solid rgba(183, 178, 158, 0.22);
  border-radius: 10px;
  padding: 12px;
  background: rgba(13, 14, 11, 0.72);
}

.shop-inventory-section > .section-heading {
  justify-content: space-between;
  gap: 12px;
  color: var(--gold);
}

.shop-inventory-event-section > .section-heading {
  color: #b8edf1;
}

.shop-inventory-capacity {
  display: inline-flex;
  min-width: 54px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 193, 78, 0.38);
  border-radius: 999px;
  padding: 2px 9px;
  background: rgba(242, 193, 78, 0.1);
  color: #f8dfa0;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.shop-inventory-event-section .shop-inventory-capacity {
  border-color: rgba(102, 197, 210, 0.42);
  background: rgba(68, 166, 184, 0.1);
  color: #b8edf1;
}

.shop-inventory-list {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  padding-right: 3px;
  scrollbar-gutter: stable;
}

.shop-inventory-legacy-section .shop-inventory-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.shop-inventory-card {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 9px;
  border: 1px solid rgba(242, 193, 78, 0.34);
  border-radius: 9px;
  padding: 12px;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.06), transparent 58%),
    #171812;
}

.shop-inventory-event-card {
  border-color: rgba(102, 197, 210, 0.4);
  background:
    linear-gradient(145deg, rgba(68, 166, 184, 0.1), transparent 58%),
    #171812;
}

.shop-inventory-event-card.is-armed {
  border-color: #9be5eb;
  box-shadow: inset 0 0 18px rgba(102, 215, 222, 0.08);
}

.shop-inventory-card-heading {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.shop-inventory-card-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 8px;
  background: rgba(242, 193, 78, 0.12);
  color: #fff0b1;
  font-size: 1.45rem;
  line-height: 1;
}

.shop-inventory-card h3 {
  margin: 0;
  color: var(--gold);
  font-size: 0.96rem;
  line-height: 1.3;
  overflow-wrap: normal;
}

.shop-inventory-event-card h3 {
  color: #b8edf1;
}

.shop-inventory-owner {
  display: block;
  margin-top: 3px;
  color: #aaa590;
  font-size: 0.72rem;
  font-weight: 800;
  overflow-wrap: normal;
}

.shop-inventory-event-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.shop-inventory-event-heading .event-timing-badges {
  justify-content: flex-end;
  margin: 0;
}

.shop-inventory-description {
  margin: 0;
  color: #d9d2bc;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-line;
}

.shop-inventory-event-state {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(102, 197, 210, 0.42);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(68, 166, 184, 0.12);
  color: #b8edf1;
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 900;
}

.shop-inventory-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 120px;
  place-items: center;
  border: 1px dashed rgba(183, 178, 158, 0.24);
  border-radius: 9px;
  padding: 16px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 880px) {
  .shop-inventory-panel {
    height: calc(100vh - 20px);
    max-height: calc(100vh - 20px);
    overflow-y: auto;
  }

  .shop-inventory-sections {
    grid-template-columns: minmax(0, 1fr);
  }

  .shop-inventory-section,
  .shop-inventory-list {
    overflow: visible;
  }
}

@media (max-width: 580px) {
  .shop-inventory-legacy-section .shop-inventory-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Marking purchase confirmation follows the shared in-game modal hierarchy. */
.marking-confirm-panel {
  width: min(720px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  overflow: auto;
}

.marking-confirm-panel > .modal-header {
  margin: 0;
}

.modal-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.marking-confirm-subtitle {
  margin: -6px 0 0;
}

.marking-confirm-mark {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(242, 193, 78, 0.48);
  border-radius: 10px;
  padding: 12px;
  background: rgba(242, 193, 78, 0.08);
}

.marking-confirm-mark-art {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    #12130f;
  background-size: 16px 16px;
}

.marking-confirm-mark-art img,
.marking-confirm-mark-art svg {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.marking-confirm-mark-copy {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
}

.marking-confirm-mark-copy small,
.marking-confirm-targets h3,
.marking-confirm-details dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.marking-confirm-mark-copy strong {
  overflow-wrap: normal;
  color: #fff2c4;
  font-size: 1.08rem;
}

.marking-confirm-targets {
  display: grid;
  gap: 8px;
}

.marking-confirm-targets h3 {
  margin: 0;
}

.marking-confirm-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(250px, 100%), 1fr));
  gap: 10px;
}

.marking-confirm-card {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px;
  background: rgba(17, 18, 15, 0.9);
}

.marking-confirm-card-portrait {
  position: relative;
  width: 84px;
  aspect-ratio: var(--card-ui-portrait-ratio, 3 / 4);
  align-self: start;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent, var(--gold)) 58%, var(--line));
  border-radius: 7px;
  background: #0d0e0c;
}

.marking-confirm-card-portrait > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.marking-confirm-card-copy {
  display: grid;
  align-content: start;
  gap: var(--card-ui-meta-gap, 6px);
  min-width: 0;
}

.marking-confirm-card-copy > strong {
  min-height: 2.4em;
  max-height: 2.4em;
  overflow: hidden;
  line-height: 1.2;
}

.marking-confirm-card-status {
  align-self: start;
  margin: 0;
}

.marking-confirm-card-marks {
  justify-self: start;
}

.marking-confirm-details {
  display: grid;
  gap: 8px;
  margin: 0;
}

.marking-confirm-details > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 38px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.marking-confirm-details dd {
  margin: 0;
  font-weight: 900;
}

.marking-confirm-price-row dd {
  color: var(--gold);
  font-size: 1.18rem;
}

.marking-confirm-actions {
  padding-top: 2px;
}

@media (max-width: 520px) {
  .marking-confirm-panel {
    gap: 12px;
    padding: 16px;
  }

  .marking-confirm-cards {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Marking tutorial: keep the shop usable while spotlighting its Marking service. */
#shopOverlay.marking-shop-tutorial-visible {
  isolation: isolate;
}

#shopOverlay.marking-shop-tutorial-visible::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.76);
  pointer-events: none;
}

#shopOverlay.marking-shop-tutorial-visible .shop-marking-item.marking-tutorial-target {
  position: relative;
  z-index: 2;
  overflow: visible;
  border-color: rgba(255, 217, 92, 0.92);
  background: #1b1b14;
  box-shadow:
    0 0 0 3px rgba(242, 193, 78, 0.3),
    0 0 28px rgba(242, 193, 78, 0.32),
    var(--shadow);
}

.shop-marking-tutorial-message {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  margin: 0 0 2px;
  border: 1px solid rgba(242, 193, 78, 0.76);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(16, 17, 13, 0.98);
  color: #fff2bc;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42);
  font-size: clamp(0.92rem, 1.1vw, 1.08rem);
  font-weight: 900;
  line-height: 1.45;
  text-align: left;
  text-wrap: balance;
  pointer-events: none;
}

.shop-marking-tutorial-message::after {
  content: none;
}

@media (max-width: 620px) {
  .shop-marking-tutorial-message {
    max-width: min(320px, calc(100vw - 24px));
    padding: 10px 12px;
  }
}

.codex-card-enhanced {
  border-color: rgba(242, 193, 78, 0.55);
  box-shadow: inset 0 0 0 1px rgba(242, 193, 78, 0.12);
}

.deck-removal-card {
  align-items: start;
}

#deckOverlay.deck-removal-overlay .deck-removal-card {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: var(--cursor-default);
}

#deckOverlay.deck-removal-overlay .deck-removal-card.is-selected {
  border-color: var(--gold);
  background: rgba(242, 193, 78, 0.12);
  box-shadow:
    inset 0 0 0 2px rgba(242, 193, 78, 0.42),
    0 0 18px rgba(242, 193, 78, 0.2);
}

.deck-marking-card:not(:disabled) {
  cursor: var(--cursor-default);
}

.deck-removal-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.deck-removal-actions .primary-button {
  min-width: 140px;
}

.deck-enhancement-card {
  width: 100%;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  height: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: var(--cursor-default);
  transition:
    border-color 140ms ease,
    background 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.deck-enhancement-card .deck-enhancement-ability-name {
  grid-row: 4;
}

.deck-enhancement-card .deck-enhancement-ability-description {
  grid-row: 5;
  align-self: start;
}

.deck-enhancement-card:not(:disabled):hover,
.deck-enhancement-card:not(:disabled):focus-visible {
  border-color: var(--gold);
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.1), transparent 58%),
    #1c1d17;
  box-shadow:
    inset 0 0 0 1px rgba(242, 193, 78, 0.12),
    0 8px 20px rgba(0, 0, 0, 0.22);
  transform: translateY(-2px);
}

.deck-enhancement-card:disabled {
  cursor: not-allowed;
  transform: none;
}

.codex-card .codex-card-portrait {
  display: grid;
  margin-top: 0;
}

.codex-card .country-flag,
.codex-card .card-field {
  margin-top: 0;
}

.codex-card .card-field {
  color: #42382d;
}

.codex-card .country-flag {
  display: grid;
}

.codex-card-unknown {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.035);
  opacity: 0.82;
}

.codex-card-locked {
  background: rgba(0, 0, 0, 0.18);
  opacity: 0.68;
}

.codex-card-unknown strong,
.codex-card-unknown .codex-card-empty-text {
  color: #7e806f;
}

.codex-card-portrait-empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.04);
}

.codex-empty-mark {
  display: grid;
  margin-top: 0;
  place-items: center;
  color: #7e806f;
  font-size: 1.45rem;
  font-weight: 1000;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 140;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(242, 193, 78, 0.48);
  border-radius: 8px;
  padding: 12px 14px;
  background: #171812;
  box-shadow: var(--shadow);
  color: var(--text);
}

.hidden {
  display: none !important;
}

body.settings-gameplay-paused .app-shell,
body.settings-gameplay-paused .app-shell *,
body.settings-gameplay-paused .overlay:not(#settingsOverlay),
body.settings-gameplay-paused .overlay:not(#settingsOverlay) * {
  animation-play-state: paused !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

#newRunButton {
  display: none !important;
}

#settingsButton {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  place-items: center;
  border-radius: 50%;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
  margin-left: 0;
}

.settings-gear-icon {
  display: block;
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 1.65rem;
  font-weight: 400;
  line-height: 1;
}

.battle-status-row > #settingsButton {
  align-self: center;
}

@media (max-width: 1180px) {
  .title-content h1 {
    white-space: normal;
  }

  .title-actions {
    flex-wrap: wrap;
  }

  .title-actions button {
    min-width: 112px;
  }

  .title-start-button {
    min-width: 160px;
  }
}

@media (max-width: 980px) {

  .app-shell {
    grid-template-columns: 1fr;
  }

  .left-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .brand-row {
    grid-column: 1 / -1;
  }

  .collection-panel {
    min-height: 120px;
    max-height: 220px;
  }

  .event-panel {
    grid-column: 1 / -1;
    min-height: 120px;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .shop-person-items {
    grid-template-columns: repeat(2, minmax(0, 348px));
  }

  .shop-event-items {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-height: 760px) {
  .app-shell {
    gap: 10px;
    padding: 10px;
  }

  .left-panel,
  .table-panel,
  .modal-panel {
    padding: 10px;
  }

  .collection-panel {
    padding: 8px;
  }

  .event-panel {
    min-height: 96px;
    max-height: none;
  }

  .brand-row p,
  .top-bar p,
  .enemy-synergies,
  .log-panel {
    display: none;
  }

  .enemy-panel {
    grid-template-columns: 130px minmax(0, 1fr);
  }

  .enemy-summary {
    grid-row: auto;
  }

  .enemy-card {
    height: 64px;
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .enemy-card-body {
    gap: 3px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  h1 {
    font-size: 1rem;
  }

  h2 {
    font-size: 1.05rem;
  }

  .primary-button,
  .secondary-button,
  .icon-text-button {
    min-height: 36px;
    padding: 0 10px;
  }

  .action-count-button {
    gap: 4px;
  }

  #playButton.action-count-button,
  #discardButton.action-count-button {
    min-height: 44px;
    padding-block: 3px;
  }

  .shop-grid .shop-card-item {
    min-height: 136px;
    gap: 3px;
    padding: 6px;
  }

  .shop-grid .shop-card-layout {
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 6px;
  }

  .shop-grid .shop-card-portrait {
    width: 62px;
  }

  .shop-grid .shop-card-item .shop-item-footer .price-button,
  .shop-service-items .shop-service-item .price-button {
    min-height: 34px;
  }

}

@media (max-width: 720px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    height: 100vh;
    overflow: hidden;
    padding: 10px;
  }

  .left-panel,
  .table-panel,
  .modal-panel {
    padding: 12px;
  }

  .left-panel {
    grid-template-columns: 1fr;
  }

  .shop-person-items {
    grid-template-columns: minmax(0, 348px);
    justify-content: center;
  }

  .top-bar,
  .modal-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .scoring-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .enemy-panel {
    grid-template-columns: 1fr;
  }

  .enemy-summary {
    grid-row: auto;
  }

  .enemy-card-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-table {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .person-card {
    grid-template-rows: minmax(84px, 48%) minmax(0, 1fr);
  }

  .primary-button,
  .secondary-button,
  .icon-text-button {
    flex: 1 1 128px;
  }
}

.table-panel {
  position: relative;
}

.enemy-panel,
.scoring-strip {
  overflow: visible;
}

.person-card {
  grid-template-rows: minmax(0, 1fr) auto;
}

.person-card .portrait {
  min-height: 0;
}

.person-card .card-body {
  display: grid;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 8px;
  min-height: clamp(78px, 13vh, 104px);
  border-top: 1px solid rgba(104, 88, 59, 0.35);
  padding: 9px 8px 10px;
  background:
    linear-gradient(180deg, rgba(255, 252, 239, 0.9), rgba(224, 210, 176, 0.95)),
    #ede6d3;
}

.person-card .card-name {
  align-self: center;
  min-width: 0;
  font-size: clamp(0.68rem, 0.94vw, 0.82rem);
  line-height: 1.08;
  text-align: center;
}

.person-card .card-status {
  align-items: flex-start;
  min-height: 28px;
}

.person-card .country-flag {
  flex-basis: 34px;
  width: 34px;
  height: 28px;
}

.person-card .card-field {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  place-items: center;
  padding: 4px 6px;
  font-size: clamp(0.64rem, 1.05vw, 0.76rem);
}

.enemy-synergies.reveal-mode,
.synergy-list.reveal-mode {
  position: relative;
  z-index: 45;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  flex: 0 0 clamp(56px, 8vh, 84px);
  min-height: clamp(56px, 8vh, 84px);
  max-height: none;
  overflow: visible;
  padding: 0;
  pointer-events: none;
}

.enemy-synergies.reveal-mode {
  top: auto;
}

.synergy-list.reveal-mode {
  top: auto;
}

.enemy-synergies.reveal-mode > .reveal-pill,
.synergy-list.reveal-mode > .reveal-pill {
  width: 100%;
  min-height: clamp(52px, 7.5vh, 78px);
  justify-items: center;
  align-content: center;
  gap: clamp(3px, 0.6vh, 6px);
  border: 1px solid rgba(242, 193, 78, 0.62);
  border-radius: 10px;
  padding: clamp(7px, 1.2vh, 12px) clamp(10px, 2.4vw, 28px);
  background:
    linear-gradient(135deg, rgba(55, 40, 18, 0.97), rgba(22, 22, 17, 0.94)),
    #1d1a12;
  box-shadow:
    0 28px 86px rgba(0, 0, 0, 0.48),
    0 0 36px rgba(242, 193, 78, 0.2);
  text-align: center;
  animation: reveal-step-big calc(220ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.enemy-synergies.reveal-mode > .reveal-pill.final,
.synergy-list.reveal-mode > .reveal-pill.final {
  border-color: var(--gold);
  background:
    linear-gradient(135deg, rgba(76, 52, 17, 0.98), rgba(31, 26, 15, 0.96)),
    #2a2112;
}

.enemy-synergies.reveal-mode > .reveal-pill strong,
.synergy-list.reveal-mode > .reveal-pill strong {
  max-width: 100%;
  overflow: visible;
  color: #ffe2a0;
  font-size: clamp(0.7rem, 1.9vw, 1.6rem);
  font-weight: 1000;
  line-height: 0.96;
  text-align: center;
  text-overflow: clip;
  text-shadow: 0 6px 28px rgba(0, 0, 0, 0.58);
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
}

.enemy-synergies.reveal-mode > .reveal-pill span,
.synergy-list.reveal-mode > .reveal-pill span {
  max-width: 100%;
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #f1d68e;
  font-size: clamp(0.45rem, 0.8vw, 0.68rem);
  font-weight: 900;
  line-height: 1.1;
  text-overflow: clip;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
}

.enemy-synergies.reveal-mode > .reveal-pill strong .reveal-base,
.enemy-synergies.reveal-mode > .reveal-pill strong .reveal-suffix,
.synergy-list.reveal-mode > .reveal-pill strong .reveal-base,
.synergy-list.reveal-mode > .reveal-pill strong .reveal-suffix {
  overflow: visible;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  text-overflow: clip;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: keep-all;
  writing-mode: horizontal-tb;
}

.enemy-synergies.reveal-mode > .reveal-pill.group-count,
.synergy-list.reveal-mode > .reveal-pill.group-count {
  animation: none;
}

.enemy-synergies.reveal-mode > .reveal-pill.group-count .reveal-suffix,
.synergy-list.reveal-mode > .reveal-pill.group-count .reveal-suffix {
  display: inline-block;
  animation: reveal-suffix-big calc(220ms * var(--game-speed-duration-scale, 1)) ease-out;
}

@keyframes reveal-step-big {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes reveal-suffix-big {
  from {
    opacity: 0;
    transform: translateX(-10px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@media (max-height: 760px) {
  .person-card .card-body {
    min-height: 68px;
    gap: 5px;
    padding: 7px;
  }

  .person-card .card-name {
    font-size: 0.68rem;
  }

  .person-card .card-status {
    min-height: 26px;
  }

  .person-card .country-flag {
    flex-basis: 30px;
    width: 30px;
    height: 24px;
  }

  .enemy-synergies.reveal-mode,
  .synergy-list.reveal-mode {
    display: grid;
    flex-basis: clamp(44px, 7vh, 60px);
    min-height: clamp(44px, 7vh, 60px);
  }

  .enemy-synergies.reveal-mode > .reveal-pill,
  .synergy-list.reveal-mode > .reveal-pill {
    min-height: clamp(40px, 6.5vh, 56px);
    padding: 6px clamp(10px, 2.5vw, 20px);
  }

  .enemy-synergies.reveal-mode > .reveal-pill strong,
  .synergy-list.reveal-mode > .reveal-pill strong {
    font-size: clamp(0.62rem, 2.1vw, 1.25rem);
  }
}

@media (max-width: 720px) {
  .person-card {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .person-card .card-body {
    min-height: 72px;
  }

  .enemy-synergies.reveal-mode,
  .synergy-list.reveal-mode {
    flex-basis: clamp(48px, 8vh, 70px);
    min-height: clamp(48px, 8vh, 70px);
  }

  .enemy-synergies.reveal-mode > .reveal-pill,
  .synergy-list.reveal-mode > .reveal-pill {
    border-radius: 10px;
    padding: 8px 12px;
  }

  .enemy-synergies.reveal-mode > .reveal-pill strong,
  .synergy-list.reveal-mode > .reveal-pill strong {
    font-size: clamp(0.72rem, 5vw, 1.75rem);
  }

  .enemy-synergies.reveal-mode > .reveal-pill span,
  .synergy-list.reveal-mode > .reveal-pill span {
    font-size: clamp(0.48rem, 2.2vw, 0.8rem);
  }
}

.enemy-panel {
  grid-template-columns: clamp(184px, 16vw, 236px) minmax(0, 1fr);
  grid-template-rows: auto minmax(126px, 1fr) auto;
  gap: 5px 6px;
  flex: 1 1 auto;
  min-height: clamp(168px, 24vh, 230px);
  max-height: clamp(238px, 32vh, 306px);
  padding: 5px;
}

.enemy-panel::before {
  content: "Enemy";
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: center;
  justify-self: center;
  color: #d8c98d;
  font-size: clamp(0.72rem, 1vw, 0.9rem);
  font-weight: 1000;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

:lang(zh-CN) .enemy-panel::before {
  content: "敌方";
}

:lang(es) .enemy-panel::before { content: "Enemigo"; }
:lang(pt) .enemy-panel::before { content: "Inimigo"; }
:lang(fr) .enemy-panel::before { content: "Adversaire"; }
:lang(de) .enemy-panel::before { content: "Gegner"; }
:lang(ko) .enemy-panel::before { content: "상대"; }

.enemy-panel.boss-round::before {
  content: "Boss";
  grid-column: 2;
}

:lang(zh-CN) .enemy-panel.boss-round::before {
  content: "首领";
}

:lang(es) .enemy-panel.boss-round::before { content: "Jefe"; }
:lang(pt) .enemy-panel.boss-round::before { content: "Chefe"; }
:lang(fr) .enemy-panel.boss-round::before { content: "Boss"; }
:lang(de) .enemy-panel.boss-round::before { content: "Boss"; }
:lang(ko) .enemy-panel.boss-round::before { content: "보스"; }

.enemy-summary {
  grid-column: 1;
  grid-row: 2 / 4;
  gap: 3px;
  padding: 5px;
}

.enemy-card-table {
  grid-column: 2;
  grid-row: 2;
  align-items: stretch;
  gap: 4px;
  height: 100%;
}

.enemy-synergies {
  grid-column: 2;
  grid-row: 3;
}

.enemy-card {
  grid-template-columns: clamp(82px, 34%, 150px) minmax(0, 1fr);
  gap: 5px;
  height: 100%;
  min-height: 116px;
}

.enemy-card-body {
  gap: 4px;
  padding: 5px 5px 5px 0;
}

.enemy-summary strong {
  display: block;
  width: 100%;
  overflow: visible;
  color: #ff6c58;
  font-size: clamp(4.2rem, 7.1vw, 5.7rem);
  line-height: 1.05;
  text-align: center;
  text-shadow: 0 0 24px rgba(255, 108, 88, 0.26);
}

.enemy-summary strong.score-bump {
  animation: enemy-score-bump calc(320ms * var(--game-speed-duration-scale, 1)) ease-out;
}

#enemyScore,
#previewScore,
.score-fly-gain,
.score-impact-fly,
.score-to-gold-bonus-step strong {
  font-family: var(--score-font);
  font-feature-settings: "lnum" 1, "tnum" 1;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: 0.015em;
  text-rendering: geometricPrecision;
}

#enemyScore,
#previewScore {
  font-weight: 800;
}

#previewScore {
  color: #ff6c58;
  font-size: clamp(3.15rem, 7vw, 5.8rem);
  line-height: 0.86;
  text-align: center;
  text-shadow: 0 0 22px rgba(255, 108, 88, 0.24);
}

.scoring-strip strong.score-bump {
  animation: enemy-score-bump calc(320ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.enemy-synergies.reveal-mode {
  flex-basis: clamp(34px, 5vh, 48px);
  min-height: clamp(34px, 5vh, 48px);
}

.enemy-synergies.reveal-mode > .reveal-pill {
  min-height: clamp(32px, 4.8vh, 44px);
  gap: 2px;
  padding: 4px clamp(8px, 1.4vw, 14px);
}

.enemy-synergies.reveal-mode > .reveal-pill strong {
  font-size: clamp(0.44rem, 1vw, 0.88rem);
}

.enemy-synergies.reveal-mode > .reveal-pill span {
  font-size: clamp(0.38rem, 0.55vw, 0.48rem);
}

.score-fly-gain {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  color: #ffe2a0;
  font-size: clamp(0.38rem, 0.48vw, 0.52rem);
  font-weight: 1000;
  line-height: 1;
  text-shadow:
    0 4px 18px rgba(0, 0, 0, 0.6),
    0 0 18px rgba(242, 193, 78, 0.36);
  white-space: nowrap;
}

.score-fly-gain.enemy-score-fly-gain {
  color: #ffd98a;
  font-size: clamp(0.44rem, 0.72vw, 0.68rem);
  text-shadow:
    0 4px 18px rgba(0, 0, 0, 0.72),
    0 0 22px rgba(242, 193, 78, 0.52);
}

.score-fly-gain.player-score-fly-gain {
  font-size: clamp(0.42rem, 0.58vw, 0.62rem);
}

.score-fly-gain.score-fly-loss {
  color: #ff7189;
  text-shadow:
    0 4px 18px rgba(0, 0, 0, 0.72),
    0 0 22px rgba(255, 70, 102, 0.58);
}

.gold-reward-fx {
  position: fixed;
  z-index: 132;
  pointer-events: none;
}

.score-to-gold-badge {
  display: grid;
  width: clamp(190px, 22vw, 300px);
  aspect-ratio: 1;
  place-items: center;
  border: 0;
  background: transparent;
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  will-change: transform, opacity;
}

.score-to-gold-core {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  isolation: isolate;
}

.score-to-gold-core::before {
  position: absolute;
  z-index: -2;
  inset: 12%;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 236, 159, 0.38) 0 18%,
    rgba(255, 190, 49, 0.2) 42%,
    rgba(255, 190, 49, 0) 72%
  );
  content: "";
  opacity: 0;
  animation: score-to-gold-glow var(--gold-reward-duration, 1800ms) ease-out both;
}

.score-to-gold-ring {
  position: absolute;
  z-index: -1;
  inset: 15%;
  border: 2px solid rgba(255, 108, 88, 0.88);
  border-radius: 50%;
  box-shadow:
    0 0 24px rgba(255, 108, 88, 0.38),
    inset 0 0 22px rgba(255, 108, 88, 0.18);
  animation: score-to-gold-ring var(--gold-reward-duration, 1800ms) ease-out both;
}

.score-to-gold-ring::before,
.score-to-gold-ring::after {
  position: absolute;
  border-radius: 50%;
  content: "";
}

.score-to-gold-ring::before {
  inset: 9%;
  border: 1px solid rgba(255, 240, 177, 0.72);
}

.score-to-gold-ring::after {
  inset: -8%;
  border: 1px dashed rgba(255, 213, 91, 0.55);
}

.score-to-gold-morph-value,
.score-to-gold-total-value {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: baseline;
  justify-content: center;
  transform: translate(-50%, -50%);
  font-size: clamp(2.6rem, 6.4vw, 5.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  text-shadow:
    0 7px 22px rgba(0, 0, 0, 0.88),
    0 0 28px rgba(255, 108, 88, 0.58);
}

.score-to-gold-morph-value {
  color: #ff7b68;
}

.score-to-gold-core.has-bonus .score-to-gold-morph-value {
  animation: score-to-gold-base-yield var(--gold-reward-duration, 1800ms) ease-in-out both;
}

.score-to-gold-digits {
  animation: score-to-gold-digits var(--gold-reward-duration, 1800ms) ease-in-out both;
}

.score-to-gold-unit {
  display: inline-grid;
  min-width: 1.5em;
  margin-left: 0.08em;
  align-items: baseline;
  perspective: 160px;
  font-size: 0.42em;
  letter-spacing: 0;
}

.score-to-gold-unit-score,
.score-to-gold-unit-g {
  grid-area: 1 / 1;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}

.score-to-gold-unit-score {
  animation: score-to-gold-score-unit var(--gold-reward-duration, 1800ms) ease-in both;
}

.score-to-gold-unit-g {
  color: #ffd45d;
  opacity: 0;
  animation: score-to-gold-gold-unit var(--gold-reward-duration, 1800ms) ease-out both;
}

.score-to-gold-transmute-coin {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  width: clamp(10px, 1.1vw, 16px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 245, 190, 0.92);
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff3b4 0 14%, #ffd35c 18% 55%, #a96512 58% 100%);
  box-shadow:
    0 0 12px rgba(255, 216, 91, 0.88),
    0 4px 9px rgba(0, 0, 0, 0.48);
  opacity: 0;
  animation: score-to-gold-transmute-coin var(--gold-reward-duration, 1800ms) ease-out both;
}

.score-to-gold-bonus-chip {
  position: absolute;
  z-index: 4;
  top: 74%;
  left: 50%;
  padding: clamp(7px, 0.8vw, 10px) clamp(12px, 1.3vw, 18px);
  border: 2px solid rgba(255, 239, 164, 0.9);
  border-radius: 999px;
  background: linear-gradient(145deg, #ffd45e, #a86413);
  box-shadow:
    0 0 20px rgba(255, 210, 70, 0.7),
    0 7px 18px rgba(0, 0, 0, 0.54);
  color: #251703;
  font-size: clamp(1rem, 2.3vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  animation: score-to-gold-bonus-merge var(--gold-reward-duration, 1800ms) ease-in-out both;
}

.score-to-gold-total-value {
  color: #ffd76a;
  opacity: 0;
  animation: score-to-gold-total-pop var(--gold-reward-duration, 1800ms) ease-out both;
  text-shadow:
    0 7px 22px rgba(0, 0, 0, 0.88),
    0 0 30px rgba(255, 218, 92, 0.78);
}

.gold-reward-coin {
  width: clamp(10px, 1.1vw, 18px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 241, 172, 0.9);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 28%, #fff2b3 0 12%, transparent 13%),
    radial-gradient(circle, #ffd86d 0 45%, #b9741a 46% 100%);
  box-shadow:
    0 0 13px rgba(255, 215, 106, 0.76),
    0 5px 14px rgba(0, 0, 0, 0.45);
}

#scoreFill.score-gold-source {
  color: #ffd76a;
  animation: score-gold-source-pulse calc(820ms * var(--game-speed-duration-scale, 1)) ease-out;
  text-shadow:
    0 0 24px rgba(255, 214, 106, 0.62),
    0 0 42px rgba(255, 108, 88, 0.3);
}

#money.money-reward-bump {
  color: #ffd76a;
  animation: money-reward-bump calc(560ms * var(--game-speed-duration-scale, 1)) ease-out;
  text-shadow:
    0 0 20px rgba(255, 214, 106, 0.7),
    0 0 34px rgba(255, 214, 106, 0.34);
}

.score-impact-fly {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  color: #ff6c58;
  min-width: clamp(120px, 15vw, 280px);
  padding: clamp(8px, 1.1vw, 16px) clamp(14px, 2vw, 28px);
  border: 2px solid rgba(255, 224, 150, 0.9);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 108, 88, 0.34), transparent 68%),
    rgba(22, 12, 8, 0.78);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.72),
    0 0 34px rgba(255, 108, 88, 0.54),
    inset 0 0 22px rgba(255, 224, 150, 0.16);
  font-size: clamp(2.15rem, 6.2vw, 6.4rem);
  font-weight: 1000;
  line-height: 1;
  text-align: center;
  text-shadow:
    0 8px 30px rgba(0, 0, 0, 0.86),
    0 0 30px rgba(255, 108, 88, 0.68);
  white-space: nowrap;
  will-change: transform, opacity;
}

.score-impact-fly.impact-landed {
  animation: score-impact-landed-glow calc(720ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.score-impact-fly.score-impact-to-gold {
  z-index: 132;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #ffd76a;
  font-size: clamp(2rem, 5vw, 5.2rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  text-shadow:
    0 7px 22px rgba(0, 0, 0, 0.88),
    0 0 34px rgba(255, 215, 92, 0.86);
}

.score-impact-fly.score-impact-to-gold.score-to-gold-arrival-value {
  z-index: 145;
  font-size: clamp(1.7rem, 4vw, 4rem);
}

.score-to-gold-arrival-coin {
  z-index: 144;
}

.score-impact-gold-value {
  display: inline-flex;
  align-items: baseline;
  animation: score-impact-to-gold-color var(--gold-reward-duration, 1800ms) ease-out both;
}

.score-impact-gold-unit {
  margin-left: 0.08em;
  font-size: 0.45em;
  letter-spacing: 0;
}

.score-impact-fly.score-impact-to-gold.score-to-gold-sequence {
  width: min(560px, calc(100vw - 36px));
  min-width: min(560px, calc(100vw - 36px));
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(255, 218, 112, 0.72);
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 222, 126, 0.18), transparent 54%),
    linear-gradient(145deg, rgba(35, 23, 15, 0.96), rgba(13, 15, 13, 0.95));
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.78),
    0 0 42px rgba(255, 127, 86, 0.34),
    inset 0 0 32px rgba(255, 220, 126, 0.08);
  color: #ff806c;
  font-size: inherit;
  letter-spacing: normal;
  text-shadow: none;
}

.score-to-gold-sequence-core {
  position: relative;
  display: grid;
  min-height: clamp(174px, 27vh, 228px);
  grid-template-rows: auto auto;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px 28px 30px;
  overflow: hidden;
  border-radius: inherit;
  isolation: isolate;
}

.score-to-gold-sequence-aura,
.score-to-gold-sequence-ring {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.score-to-gold-sequence-aura {
  width: 62%;
  aspect-ratio: 1;
  background: radial-gradient(circle, rgba(255, 105, 81, 0.28), rgba(255, 105, 81, 0) 68%);
  transition:
    background calc(260ms * var(--game-speed-duration-scale, 1)) ease-out,
    filter calc(260ms * var(--game-speed-duration-scale, 1)) ease-out,
    transform calc(260ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.score-to-gold-sequence-ring {
  width: clamp(116px, 29%, 158px);
  aspect-ratio: 1;
  border: 2px solid rgba(255, 118, 89, 0.56);
  box-shadow:
    0 0 26px rgba(255, 108, 88, 0.3),
    inset 0 0 22px rgba(255, 108, 88, 0.13);
  animation: score-to-gold-sequence-ring var(--gold-reward-duration, 3000ms) linear both;
}

.score-to-gold-sequence-caption {
  position: absolute;
  top: 19px;
  left: 50%;
  color: #ffe4b0;
  font-size: clamp(0.72rem, 1.35vw, 0.94rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  opacity: 0.88;
  transform: translateX(-50%);
}

.score-to-gold-sequence .score-impact-gold-value.score-to-gold-running-value {
  position: relative;
  z-index: 3;
  display: inline-flex;
  align-items: baseline;
  animation: none;
  color: #ff806c;
  font-size: clamp(2.7rem, 7vw, 5.6rem);
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  letter-spacing: -0.045em;
  line-height: 1;
  text-shadow:
    0 7px 22px rgba(0, 0, 0, 0.86),
    0 0 28px rgba(255, 108, 88, 0.58);
  transition:
    color calc(260ms * var(--game-speed-duration-scale, 1)) ease-out,
    text-shadow calc(260ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.score-to-gold-sequence .score-to-gold-running-unit {
  min-width: 1.3em;
  margin-left: 0.12em;
  color: #ffc4a7;
  font-size: 0.34em;
  font-weight: 1000;
  letter-spacing: 0;
  transition: color calc(260ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.score-to-gold-bonus-stack {
  position: relative;
  z-index: 5;
  display: grid;
  width: min(420px, calc(100% - 6px));
  gap: 6px;
  pointer-events: none;
}

.score-to-gold-bonus-step {
  position: relative;
  display: inline-flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 238, 174, 0.84);
  border-radius: 999px;
  background: linear-gradient(145deg, rgba(255, 209, 95, 0.98), rgba(184, 102, 25, 0.98));
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.56),
    0 0 22px rgba(255, 196, 70, 0.46);
  color: #261704;
  opacity: 0;
  transform: translateY(18px) scale(0.82);
}

.score-to-gold-bonus-gain {
  z-index: 134;
  color: #ffe27c;
  font-size: clamp(1rem, 2.2vw, 1.38rem);
  text-shadow:
    0 5px 18px rgba(0, 0, 0, 0.78),
    0 0 24px rgba(255, 205, 84, 0.72);
}

.score-to-gold-bonus-step.is-hand-bonus {
  background: linear-gradient(145deg, #ffe27c, #c48624);
}

.score-to-gold-bonus-step.is-discard-bonus {
  background: linear-gradient(145deg, #ffd068, #b86c20);
}

.score-to-gold-bonus-step.is-enhancement-bonus {
  border-color: rgba(191, 235, 255, 0.88);
  background: linear-gradient(145deg, #c9efff, #5a90b4);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.56),
    0 0 22px rgba(112, 204, 255, 0.42);
  color: #071a29;
}

.score-to-gold-bonus-step small {
  overflow: hidden;
  font-size: clamp(0.72rem, 1.5vw, 0.94rem);
  font-weight: 900;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-to-gold-bonus-step strong {
  flex: 0 0 auto;
  font-size: clamp(1rem, 2.2vw, 1.38rem);
  font-variant-numeric: tabular-nums;
  font-weight: 1000;
  white-space: nowrap;
}

.score-to-gold-conversion-label {
  position: absolute;
  z-index: 6;
  right: 20px;
  bottom: 16px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 228, 125, 0.72);
  border-radius: 999px;
  background: rgba(60, 39, 5, 0.86);
  color: #ffe27a;
  font-size: clamp(0.68rem, 1.2vw, 0.86rem);
  font-weight: 1000;
  letter-spacing: 0.06em;
  opacity: 0;
  transform: translateY(8px) scale(0.88);
}

.score-to-gold-sequence.is-gold {
  border-color: rgba(255, 229, 131, 0.96);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.78),
    0 0 58px rgba(255, 206, 67, 0.68),
    inset 0 0 38px rgba(255, 226, 128, 0.16);
}

.score-to-gold-sequence.is-gold .score-to-gold-sequence-aura {
  background: radial-gradient(circle, rgba(255, 221, 101, 0.5), rgba(255, 197, 42, 0) 70%);
  filter: brightness(1.34);
  transform: translate(-50%, -50%) scale(1.18);
}

.score-to-gold-sequence.is-gold .score-to-gold-running-value,
.score-to-gold-sequence.is-gold .score-to-gold-running-unit {
  color: #ffd75f;
  text-shadow:
    0 7px 22px rgba(0, 0, 0, 0.88),
    0 0 38px rgba(255, 217, 83, 0.9);
}

.score-to-gold-sequence.is-gold .score-to-gold-conversion-label {
  animation: score-to-gold-conversion-label calc(520ms * var(--game-speed-duration-scale, 1)) ease-out both;
}

.score-to-gold-flight-coin {
  opacity: 0;
}

.score-impact-flash,
.score-impact-wave,
.score-impact-pop,
.score-impact-burst,
.score-impact-spark,
.score-impact-core,
.score-impact-ray,
.score-impact-shard {
  position: fixed;
  z-index: 118;
  pointer-events: none;
}

.score-impact-flash {
  inset: 0;
  background:
    radial-gradient(circle at var(--impact-x) var(--impact-y), rgba(255, 236, 174, 0.52), transparent 0 16%, rgba(255, 108, 88, 0.22) 24%, transparent 42%),
    rgba(255, 108, 88, 0.07);
  animation: score-impact-flash calc(520ms * var(--game-speed-duration-scale, 1)) ease-out forwards;
}

.score-impact-wave {
  z-index: 119;
  border: 3px solid rgba(255, 225, 142, 0.86);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 108, 88, 0.38), rgba(255, 108, 88, 0.08) 48%, transparent 68%);
  box-shadow:
    0 0 28px rgba(255, 108, 88, 0.62),
    inset 0 0 22px rgba(255, 225, 142, 0.32);
  animation: score-impact-wave calc(620ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.78, 0.22, 1) forwards;
}

.score-impact-wave.is-echo {
  z-index: 120;
  border-color: rgba(255, 106, 78, 0.96);
  background: transparent;
  box-shadow:
    0 0 34px rgba(255, 76, 54, 0.82),
    inset 0 0 24px rgba(255, 218, 122, 0.42);
  animation-delay: calc(70ms * var(--game-speed-duration-scale, 1));
}

.score-impact-burst {
  z-index: 122;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff9d7 0 8%, #ffe074 12%, rgba(255, 92, 58, 0.92) 24%, rgba(255, 70, 46, 0.28) 48%, transparent 72%);
  box-shadow:
    0 0 26px rgba(255, 248, 202, 0.98),
    0 0 58px rgba(255, 111, 65, 0.9),
    0 0 92px rgba(255, 67, 45, 0.52);
  mix-blend-mode: screen;
  animation: score-impact-burst calc(560ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.84, 0.2, 1) forwards;
}

.score-impact-core {
  z-index: 124;
  border: 2px solid rgba(255, 252, 218, 0.96);
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 10%, #fff3a5 18%, #ff9d45 38%, rgba(255, 58, 32, 0.66) 62%, transparent 74%);
  box-shadow:
    0 0 18px rgba(255, 255, 229, 1),
    0 0 42px rgba(255, 213, 92, 0.96),
    0 0 88px rgba(255, 76, 38, 0.82);
  mix-blend-mode: screen;
  animation: score-impact-core calc(600ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.88, 0.18, 1) forwards;
}

.score-impact-ray {
  z-index: 121;
  width: var(--ray-length);
  height: clamp(4px, 0.42vw, 8px);
  border-radius: 999px;
  background: linear-gradient(90deg, #fffef0 0 8%, #ffe16f 18%, rgba(255, 112, 56, 0.88) 58%, transparent 100%);
  box-shadow:
    0 0 12px rgba(255, 246, 185, 0.98),
    0 0 24px rgba(255, 88, 48, 0.72);
  transform-origin: 0 50%;
  mix-blend-mode: screen;
  animation: score-impact-ray calc(720ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.82, 0.2, 1) var(--ray-delay, 0ms) forwards;
}

.score-impact-shard {
  z-index: 123;
  width: clamp(7px, 0.65vw, 12px);
  height: clamp(13px, 1.2vw, 22px);
  clip-path: polygon(50% 0, 100% 44%, 64% 100%, 0 70%);
  background: linear-gradient(145deg, #fffbd0, #ffca45 48%, #ff5638);
  box-shadow: 0 0 16px rgba(255, 191, 70, 0.9);
  animation: score-impact-shard calc(760ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.08, 0.72, 0.16, 1) var(--shard-delay, 0ms) forwards;
}

.score-impact-spark {
  z-index: 123;
  width: clamp(5px, 0.55vw, 9px);
  height: clamp(16px, 2.4vw, 34px);
  border-radius: 999px;
  background: linear-gradient(to bottom, #fffbd4, #ffd659 48%, #ff5d3f);
  box-shadow:
    0 0 10px rgba(255, 247, 184, 0.96),
    0 0 20px rgba(255, 93, 63, 0.74);
  animation: score-impact-spark calc(700ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.76, 0.24, 1) var(--spark-delay, 0ms) forwards;
}

.score-impact-spark:nth-of-type(3n) {
  background: linear-gradient(to bottom, #ffffff, #8ff1ff 45%, #5ca8ff);
  box-shadow:
    0 0 10px rgba(224, 253, 255, 0.98),
    0 0 20px rgba(92, 168, 255, 0.78);
}

.score-impact-pop {
  z-index: 121;
  color: #fff2bf;
  font-size: clamp(1rem, 2.6vw, 2.65rem);
  font-weight: 1000;
  line-height: 1;
  text-shadow:
    0 5px 18px rgba(0, 0, 0, 0.8),
    0 0 18px rgba(255, 224, 150, 0.56);
  white-space: nowrap;
  animation: score-impact-pop calc(640ms * var(--game-speed-duration-scale, 1)) ease-out forwards;
}

.enemy-panel.impact-shake {
  animation: score-impact-shake calc(520ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.18, 0.88, 0.28, 1);
}

.enemy-summary strong.impact-hit {
  color: #fff0bd;
  animation: enemy-score-impact-hit calc(520ms * var(--game-speed-duration-scale, 1)) ease-out;
}

.victory-overlay,
.victory-banner,
.victory-burst,
.victory-particle {
  position: fixed;
  pointer-events: none;
}

.victory-overlay {
  inset: 0;
  z-index: 126;
  background:
    radial-gradient(circle at var(--victory-x) var(--victory-y), rgba(255, 229, 152, 0.42), transparent 0 18%, rgba(86, 190, 143, 0.18) 27%, transparent 46%),
    rgba(255, 229, 152, 0.08);
  animation: victory-overlay-flash calc(1200ms * var(--game-speed-duration-scale, 1)) ease-out forwards;
}

.victory-banner {
  left: 50%;
  top: 42%;
  z-index: 130;
  display: grid;
  min-width: min(560px, 72vw);
  place-items: center;
  padding: clamp(18px, 3vw, 34px) clamp(28px, 5vw, 64px);
  border: 2px solid rgba(255, 226, 144, 0.92);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 226, 144, 0.24), rgba(86, 190, 143, 0.18)),
    rgba(14, 16, 12, 0.9);
  box-shadow:
    0 22px 60px rgba(0, 0, 0, 0.74),
    0 0 44px rgba(255, 212, 106, 0.46),
    inset 0 0 30px rgba(255, 226, 144, 0.14);
  animation: victory-banner-pop calc(1320ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.14, 0.88, 0.22, 1) forwards;
}

.victory-banner strong {
  color: #ffe7a5;
  font-size: clamp(3.4rem, 10vw, 8.6rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 0.95;
  text-shadow:
    0 10px 34px rgba(0, 0, 0, 0.82),
    0 0 38px rgba(255, 221, 126, 0.62);
}

.victory-banner span {
  margin-top: 8px;
  color: #8ff0bd;
  font-size: clamp(0.8rem, 1.4vw, 1.2rem);
  font-weight: 1000;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.victory-burst {
  z-index: 127;
  width: clamp(150px, 18vw, 280px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 226, 144, 0.86);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 226, 144, 0.42), rgba(86, 190, 143, 0.2) 48%, transparent 70%);
  box-shadow:
    0 0 40px rgba(255, 226, 144, 0.58),
    inset 0 0 30px rgba(86, 190, 143, 0.22);
  animation: victory-burst calc(1180ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.82, 0.2, 1) forwards;
}

.victory-particle {
  z-index: 128;
  width: clamp(7px, 0.9vw, 13px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffe7a5;
  box-shadow:
    0 0 12px rgba(255, 226, 144, 0.82),
    0 0 20px rgba(86, 190, 143, 0.42);
  animation: victory-particle calc(980ms * var(--game-speed-duration-scale, 1)) cubic-bezier(0.12, 0.78, 0.2, 1) var(--delay, 0ms) forwards;
}

.enemy-panel.victory-defeated {
  animation: enemy-defeated calc(980ms * var(--game-speed-duration-scale, 1)) ease-out forwards;
}

@keyframes victory-overlay-flash {
  0% {
    opacity: 0;
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes victory-banner-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.62);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -64%) scale(0.92);
  }
}

@keyframes victory-burst {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.12);
  }
  72% {
    opacity: 0.7;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(2.3);
  }
}

@keyframes victory-particle {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.9);
  }
}

@keyframes enemy-defeated {
  0% {
    filter: brightness(1);
    transform: translateY(0) scale(1);
  }
  42% {
    filter: brightness(1.45) saturate(1.25);
    transform: translateY(-4px) scale(1.01);
  }
  100% {
    filter: brightness(0.58) grayscale(0.55);
    transform: translateY(6px) scale(0.985);
  }
}

@keyframes score-impact-flash {
  0% {
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes score-impact-wave {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.16);
  }
  70% {
    opacity: 0.62;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.28);
  }
}

@keyframes score-impact-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.08);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
  }
  44% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(0.78);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.72);
  }
}

@keyframes score-impact-core {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.06) rotate(-18deg);
  }
  15% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.18) rotate(6deg);
  }
  42% {
    opacity: 0.96;
    transform: translate(-50%, -50%) scale(0.72) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9) rotate(24deg);
  }
}

@keyframes score-impact-ray {
  0% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--ray-rotation)) scaleX(0.04);
  }
  18% {
    opacity: 1;
    transform: translateY(-50%) rotate(var(--ray-rotation)) scaleX(1);
  }
  55% {
    opacity: 0.82;
  }
  100% {
    opacity: 0;
    transform: translateY(-50%) rotate(var(--ray-rotation)) scaleX(1.32);
  }
}

@keyframes score-impact-shard {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--shard-rotation)) scale(0.2);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--shard-rotation)) scale(1.1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--shard-dx)), calc(-50% + var(--shard-dy))) rotate(calc(var(--shard-rotation) + 210deg)) scale(0.42);
  }
}

@keyframes score-impact-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--spark-rotation)) scaleY(0.18);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--spark-rotation)) scaleY(1.12);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-dx)), calc(-50% + var(--spark-dy))) rotate(var(--spark-rotation)) scaleY(0.24);
  }
}

@keyframes score-impact-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.72);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.18);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -112%) scale(0.88);
  }
}

@keyframes score-impact-landed-glow {
  0% {
    color: #fff2bf;
    filter: brightness(1.45) saturate(1.3);
    text-shadow:
      0 8px 30px rgba(0, 0, 0, 0.86),
      0 0 46px rgba(255, 231, 160, 0.96);
  }
  100% {
    color: #ff6c58;
    filter: brightness(1) saturate(1);
    text-shadow:
      0 8px 30px rgba(0, 0, 0, 0.86),
      0 0 30px rgba(255, 108, 88, 0.68);
  }
}

@keyframes score-impact-to-gold-color {
  0% {
    color: #ff7b68;
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 28px rgba(255, 108, 88, 0.58);
  }
  20% {
    color: #fff5c4;
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 44px rgba(255, 241, 172, 0.98);
  }
  34%,
  100% {
    color: #ffd76a;
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 34px rgba(255, 215, 92, 0.86);
  }
}

@keyframes score-to-gold-sequence-ring {
  0% {
    border-color: rgba(255, 118, 89, 0.42);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.66) rotate(-24deg);
  }
  14% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) rotate(0deg);
  }
  62% {
    border-color: rgba(255, 150, 90, 0.72);
    opacity: 0.9;
    transform: translate(-50%, -50%) scale(1.06) rotate(126deg);
  }
  76% {
    border-color: rgba(255, 230, 131, 0.98);
    box-shadow:
      0 0 42px rgba(255, 211, 66, 0.8),
      inset 0 0 30px rgba(255, 225, 107, 0.3);
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.22) rotate(168deg);
  }
  100% {
    border-color: rgba(255, 222, 105, 0.56);
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.74) rotate(236deg);
  }
}

@keyframes score-to-gold-conversion-label {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.88);
  }
  48% {
    opacity: 1;
    transform: translateY(-2px) scale(1.08);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes score-impact-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  12% {
    transform: translateX(-10px);
  }
  24% {
    transform: translateX(9px);
  }
  38% {
    transform: translateX(-7px);
  }
  54% {
    transform: translateX(5px);
  }
  72% {
    transform: translateX(-3px);
  }
}

@keyframes enemy-score-impact-hit {
  0% {
    transform: scale(1);
    text-shadow: 0 0 22px rgba(255, 108, 88, 0.24);
  }
  35% {
    transform: scale(1.3);
    text-shadow:
      0 0 34px rgba(255, 226, 152, 0.72),
      0 0 42px rgba(255, 108, 88, 0.68);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes enemy-score-bump {
  0% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes score-to-gold-glow {
  0%,
  14% {
    opacity: 0;
    transform: scale(0.4);
  }
  28% {
    opacity: 0.52;
    transform: scale(0.72);
  }
  42% {
    opacity: 1;
    transform: scale(1.24);
  }
  58% {
    opacity: 0.78;
    transform: scale(1);
  }
  78%,
  100% {
    opacity: 0;
    transform: scale(0.72);
  }
}

@keyframes score-to-gold-ring {
  0%,
  13% {
    border-color: rgba(255, 108, 88, 0.7);
    box-shadow:
      0 0 18px rgba(255, 108, 88, 0.32),
      inset 0 0 18px rgba(255, 108, 88, 0.14);
    opacity: 0;
    transform: scale(0.54) rotate(-35deg);
  }
  23% {
    border-color: rgba(255, 108, 88, 0.92);
    opacity: 1;
    transform: scale(0.9) rotate(-10deg);
  }
  37% {
    border-color: rgba(255, 241, 172, 1);
    box-shadow:
      0 0 38px rgba(255, 211, 72, 0.82),
      inset 0 0 28px rgba(255, 225, 112, 0.38);
    opacity: 1;
    transform: scale(1.16) rotate(16deg);
  }
  55% {
    border-color: rgba(255, 211, 80, 0.92);
    opacity: 0.86;
    transform: scale(1) rotate(46deg);
  }
  76%,
  100% {
    opacity: 0;
    transform: scale(0.68) rotate(76deg);
  }
}

@keyframes score-to-gold-digits {
  0%,
  29% {
    color: #ff7b68;
    filter: saturate(1);
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 28px rgba(255, 108, 88, 0.58);
  }
  37% {
    color: #fff5c4;
    filter: saturate(1.25) brightness(1.22);
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 42px rgba(255, 241, 172, 0.98);
  }
  44%,
  100% {
    color: #ffd45d;
    filter: saturate(1.05);
    text-shadow:
      0 7px 22px rgba(0, 0, 0, 0.88),
      0 0 30px rgba(255, 211, 74, 0.78);
  }
}

@keyframes score-to-gold-score-unit {
  0%,
  29% {
    opacity: 1;
    transform: rotateX(0deg) scale(1);
  }
  38%,
  100% {
    opacity: 0;
    transform: rotateX(90deg) scale(0.72);
  }
}

@keyframes score-to-gold-gold-unit {
  0%,
  31% {
    opacity: 0;
    transform: rotateX(-90deg) scale(0.72);
  }
  40%,
  100% {
    opacity: 1;
    transform: rotateX(0deg) scale(1);
  }
}

@keyframes score-to-gold-transmute-coin {
  0%,
  29% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--coin-angle)) translateY(0) scale(0.18);
  }
  38% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(var(--coin-angle)) translateY(-42px) scale(1.12);
  }
  55% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--coin-angle)) translateY(-92px) scale(0.68);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--coin-angle)) translateY(-92px) scale(0.68);
  }
}

@keyframes score-to-gold-bonus-merge {
  0%,
  48% {
    opacity: 0;
    transform: translate(-50%, 24px) scale(0.52);
  }
  56% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.08);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -42px) scale(0.92);
  }
  72%,
  100% {
    opacity: 0;
    transform: translate(-50%, -72px) scale(0.3);
  }
}

@keyframes score-to-gold-base-yield {
  0%,
  67% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  73%,
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.62);
  }
}

@keyframes score-to-gold-total-pop {
  0%,
  68% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.46);
  }
  75% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.16);
  }
  82%,
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes score-gold-source-pulse {
  0% {
    transform: scale(1);
  }
  32% {
    transform: scale(1.16);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes money-reward-bump {
  0% {
    transform: scale(1);
  }
  38% {
    transform: scale(1.24);
  }
  100% {
    transform: scale(1);
  }
}

@media (max-height: 760px) {
  .enemy-panel {
    grid-template-columns: clamp(148px, 17vw, 190px) minmax(0, 1fr);
  }

  #enemyArrivalNotice.boss-effect-visible .enemy-arrival-message {
    gap: 2px;
    padding: 5px 12px;
  }

  .battle-status-row ~ .card-table {
    flex-basis: clamp(252px, 39vh, 312px);
    min-height: 252px;
  }

  .enemy-summary strong {
    font-size: clamp(3.15rem, 8.6vh, 4.25rem);
  }

  .enemy-synergies.reveal-mode {
    flex-basis: clamp(30px, 4.5vh, 40px);
    min-height: clamp(30px, 4.5vh, 40px);
  }

  .enemy-synergies.reveal-mode > .reveal-pill {
    min-height: clamp(28px, 4.2vh, 38px);
    padding: 4px clamp(7px, 1.2vw, 12px);
  }

  .enemy-synergies.reveal-mode > .reveal-pill strong {
    font-size: clamp(0.4rem, 0.95vw, 0.72rem);
  }
}

@media (max-width: 720px) {
  .battle-status-row {
    flex-wrap: wrap;
  }

  .battle-status-row > .run-card {
    flex-basis: min(100%, 360px);
    width: min(100%, 360px);
  }

  .battle-status-row > #tutorialOverlay,
  .battle-status-row > #enemyArrivalNotice,
  .battle-status-row > #clearConditionMessage {
    flex: 1 1 100%;
  }

  .enemy-panel {
    grid-template-columns: 1fr;
  }

  .enemy-summary {
    grid-column: 1;
    grid-row: 2;
  }

  .enemy-card-table {
    grid-column: 1;
    grid-row: 3;
  }

  .enemy-synergies {
    grid-column: 1;
    grid-row: 4;
  }

  .enemy-summary strong {
    font-size: clamp(3.4rem, 17vw, 4.8rem);
  }

  .enemy-synergies.reveal-mode > .reveal-pill strong {
    font-size: clamp(0.42rem, 2.1vw, 0.75rem);
  }
}

/* Permanent Legacy collection, shop offer, and gameplay choice UI. */
.legacy-panel {
  flex: 0 1 auto;
  min-height: 0;
  border-color: rgba(242, 193, 78, 0.42);
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.09), transparent 54%),
    var(--panel-2);
}

.legacy-panel .section-heading {
  color: var(--gold);
}

.legacy-capacity {
  display: inline-flex;
  min-width: 48px;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 193, 78, 0.44);
  border-radius: 999px;
  padding: 2px 8px;
  background: rgba(242, 193, 78, 0.1);
  color: #f8dfa0;
  font-size: 0.7rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.legacy-capacity.is-full,
.legacy-capacity[data-full="true"] {
  border-color: rgba(255, 226, 126, 0.8);
  background: rgba(242, 193, 78, 0.18);
  color: #fff1bd;
  box-shadow: 0 0 12px rgba(242, 193, 78, 0.12);
}

.legacy-list {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: repeat(3, minmax(96px, max-content));
  gap: 6px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.legacy-slot,
.legacy-chip,
.legacy-list > .collection-chip,
.legacy-list > .collection-empty {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 96px;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  align-content: start;
  column-gap: 8px;
  row-gap: 4px;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.32);
  border-radius: 7px;
  padding: 7px 8px;
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.07), transparent 58%),
    #171812;
}

.legacy-slot-icon,
.legacy-icon,
.legacy-chip > em:first-child {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  align-self: center;
  border: 1px solid rgba(242, 193, 78, 0.4);
  border-radius: 7px;
  background: rgba(242, 193, 78, 0.12);
  color: #fff0b1;
  font-size: 1rem;
  font-style: normal;
  font-weight: 1000;
  line-height: 1;
}

.legacy-slot strong,
.legacy-chip strong,
.legacy-list > .collection-chip strong {
  grid-column: 2;
  margin: 0;
  overflow: visible;
  color: var(--gold);
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: normal;
}

.legacy-slot .legacy-owner {
  grid-column: 2;
  overflow: visible;
  color: #a9a38f;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: normal;
}

.legacy-panel .legacy-description,
.legacy-slot p,
.legacy-chip p,
.legacy-list > .collection-chip span {
  grid-column: 1 / -1;
  display: block;
  margin: 3px 0 0;
  overflow: visible;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  text-wrap: pretty;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
}

.legacy-description.is-owner-enhanced,
.legacy-slot.is-owner-enhanced .legacy-description,
.legacy-chip.is-owner-enhanced .legacy-description,
.legacy-chip[data-owner-enhanced="true"] .legacy-description,
.legacy-slot[data-owner-enhanced="true"] p {
  color: #ffe274;
  font-weight: 900;
  text-shadow: 0 0 12px rgba(242, 193, 78, 0.2);
}

.legacy-slot-empty,
.legacy-slot.is-empty,
.legacy-list > .collection-empty {
  min-height: 96px;
  border-style: dashed;
  border-color: rgba(242, 193, 78, 0.2);
  background: rgba(17, 18, 15, 0.4);
  opacity: 0.7;
}

.legacy-slot-empty::after,
.legacy-slot.is-empty::after,
.legacy-list > .collection-empty:empty::after {
  content: "";
  grid-column: 1 / -1;
  width: 22px;
  height: 3px;
  place-self: center;
  border-radius: 999px;
  background: rgba(242, 193, 78, 0.22);
}

/* Shop layout system: one three-column rhythm from merchandise through services. */
.shop-panel {
  --shop-column-gap: clamp(10px, 0.85vw, 16px);
  --shop-row-gap: clamp(10px, 1.15vh, 16px);
  --shop-card-padding: clamp(10px, 0.85vw, 15px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-content: stretch;
  gap: var(--shop-row-gap);
  overflow: hidden;
  padding: clamp(14px, 1.4vw, 28px);
}

.shop-panel > .modal-header,
.shop-panel > .shop-grid,
.shop-panel > .shop-services {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.shop-panel .shop-header {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(330px, 1.25fr) auto;
  align-items: center;
  gap: clamp(16px, 2vw, 32px);
  margin: 0;
  padding-bottom: clamp(8px, 1vh, 12px);
  border-bottom: 1px solid rgba(183, 178, 158, 0.2);
}

.shop-upcoming-boss {
  display: grid;
  min-width: 0;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(219, 91, 67, 0.48);
  border-radius: 10px;
  padding: 7px 10px;
  background: linear-gradient(135deg, rgba(130, 35, 26, 0.28), rgba(12, 13, 11, 0.9));
}

.shop-upcoming-boss-portrait {
  display: block;
  width: 52px;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid rgba(244, 207, 121, 0.4);
  border-radius: 7px;
  background: #11120f;
}

.shop-upcoming-boss-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.shop-upcoming-boss-copy {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 1px;
}

.shop-upcoming-boss-kicker {
  color: #ff9b82;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.shop-upcoming-boss-name,
.shop-upcoming-boss-ability-name,
.shop-upcoming-boss-description {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shop-upcoming-boss-name {
  color: #fff0d0;
  font-size: 0.88rem;
}

.shop-upcoming-boss-ability-name {
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 900;
}

.shop-upcoming-boss-description {
  color: #d5cdbb;
  font-size: 0.72rem;
}

.shop-heading-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.shop-screen-label {
  justify-self: start;
  color: var(--gold);
  font-size: clamp(1rem, 1.15vw, 1.25rem);
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1;
}

.shop-panel .shop-heading-copy h2 {
  color: #fff1bd;
  font-size: clamp(1.5rem, 1.8vw, 2rem);
  line-height: 1.1;
}

.shop-toolbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.shop-panel .shop-money {
  display: flex;
  min-width: 96px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  margin: 0;
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(242, 193, 78, 0.09);
  font-variant-numeric: tabular-nums;
}

.shop-panel .shop-money strong {
  color: #ffe274;
  font-size: clamp(1.15rem, 1.25vw, 1.4rem);
  line-height: 1;
}

.shop-panel .modal-actions {
  flex-wrap: nowrap;
  gap: 8px;
}

.shop-panel .modal-actions .secondary-button {
  min-height: 44px;
  padding-inline: 15px;
  white-space: nowrap;
}

.shop-grid {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(250px, 1fr) clamp(230px, 27vh, 280px);
  align-content: stretch;
  gap: var(--shop-row-gap);
}

.shop-people-section,
.shop-legacy-section,
.shop-event-section {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.shop-panel .section-heading {
  min-height: 22px;
  margin: 0 0 6px;
  color: #c9c3ad;
  font-size: clamp(0.78rem, 0.75vw, 0.86rem);
  letter-spacing: 0.06em;
}

.shop-panel .section-heading::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  margin-left: 10px;
  background: linear-gradient(90deg, rgba(183, 178, 158, 0.28), transparent);
}

.shop-secondary-row {
  display: grid;
  min-width: 0;
  min-height: 0;
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--shop-column-gap);
}

.shop-person-items,
.shop-legacy-items,
.shop-event-items {
  min-width: 0;
  min-height: 0;
}

.shop-person-items {
  width: 100%;
  height: 100%;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: stretch;
  gap: var(--shop-column-gap);
}

.shop-legacy-section {
  grid-column: 1;
}

.shop-event-section {
  grid-column: 2 / -1;
}

.shop-legacy-section > .shop-legacy-items {
  height: 100%;
  grid-template-columns: minmax(0, 1fr);
}

.shop-event-section > .shop-event-items {
  height: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--shop-column-gap);
}

.shop-legacy-items > .shop-item,
.shop-event-items > .shop-item,
.shop-legacy-item,
.shop-event-item {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.shop-panel .shop-item {
  gap: 9px;
  overflow: hidden;
  border-radius: 12px;
  padding: var(--shop-card-padding);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.shop-panel .shop-item:focus-within {
  border-color: rgba(242, 193, 78, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 0 2px rgba(242, 193, 78, 0.1);
}

.shop-grid .shop-card-item {
  height: 100%;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.shop-grid .shop-card-layout {
  height: 100%;
  min-height: 0;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(12px, 1vw, 18px);
  align-items: center;
}

.shop-grid .shop-card-portrait {
  width: auto;
  height: 100%;
  max-width: 100%;
  max-height: clamp(260px, 30vw, 500px);
  justify-self: start;
  align-self: center;
}

.shop-grid .shop-card-copy {
  align-content: center;
  gap: 8px;
}

.shop-grid .shop-card-copy h3 {
  color: #ffe274;
  font-size: clamp(1rem, 1.05vw, 1.22rem);
  line-height: 1.3;
  overflow-wrap: normal;
  text-wrap: balance;
}

.shop-grid .shop-card-status {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px;
}

.shop-grid .shop-card-status .card-fields {
  max-width: 100%;
  flex-wrap: wrap;
}

.shop-panel .shop-item-footer {
  align-self: end;
}

.shop-panel .shop-card-item .shop-item-footer .price-button,
.shop-panel .shop-legacy-item .shop-item-footer .price-button,
.shop-panel .shop-event-item .shop-item-footer .price-button {
  width: 112px;
  height: 46px;
  min-width: 112px;
  min-height: 46px;
  padding-inline: 18px;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.shop-legacy-item,
.shop-event-item {
  grid-template-rows: 3.25rem minmax(0, 1fr) auto;
}

.shop-legacy-item {
  border-color: rgba(242, 193, 78, 0.46);
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.1), transparent 58%),
    #171812;
}

.shop-legacy-item h3 {
  color: var(--gold);
}

.shop-legacy-title-row {
  display: flex;
  max-width: 100%;
  min-width: 0;
  min-height: 3.25rem;
  align-items: center;
  gap: 0.625rem;
}

.shop-legacy-title-row h3 {
  flex: 0 1 auto;
  min-width: 0;
  overflow-wrap: normal;
}

.shop-legacy-title-row .shop-legacy-owner {
  flex: 1 1 8rem;
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}

.shop-offer-description,
.shop-legacy-description,
.shop-event-description,
.shop-legacy-item .legacy-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #d9d2bc;
  font-size: clamp(0.88rem, 0.82vw, 0.96rem);
  line-height: 1.5;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.shop-legacy-item .shop-legacy-icon {
  display: grid;
  flex: 0 0 3.25rem;
  width: 3.25rem;
  height: 3.25rem;
  place-items: center;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.42);
  border-radius: 10px;
  padding: 0;
  background: rgba(242, 193, 78, 0.1);
  color: #f8dfa0;
  font-size: calc(0.65rem * 4);
  line-height: 1;
}

.shop-legacy-owner {
  color: #d9d2bc;
  font-size: 0.78rem;
  font-weight: 800;
}

.shop-secondary-row .shop-legacy-item h3,
.shop-secondary-row .shop-event-item h3 {
  font-size: clamp(1rem, 0.95vw, 1.15rem);
  line-height: 1.3;
}

.shop-secondary-row .shop-event-item > h3 {
  display: flex;
  min-height: 3.25rem;
  align-items: center;
}

body.high-contrast .shop-offer-description {
  color: var(--text);
}

.shop-secondary-row .shop-empty {
  min-height: 0;
  height: 100%;
}

.shop-services {
  display: grid;
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--shop-column-gap);
  margin: 0;
  justify-items: stretch;
}

.shop-service-items {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--shop-column-gap);
}

.shop-service-items .shop-service-item {
  width: 100%;
  min-height: 64px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
}

.shop-service-items .shop-service-item h3 {
  font-size: 1rem;
  line-height: 1.25;
}

.shop-service-items .shop-service-item .price-button {
  min-width: 112px;
  min-height: 44px;
}

@media (min-width: 981px) {
  .shop-grid .shop-card-item {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: clamp(12px, 1vw, 18px);
    row-gap: 10px;
  }

  .shop-grid .shop-card-layout {
    display: contents;
  }

  .shop-grid .shop-card-portrait {
    grid-column: 1;
    grid-row: 1 / 3;
    align-self: end;
  }

  .shop-grid .shop-card-copy {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
  }

  .shop-grid .shop-card-item > .shop-item-footer {
    grid-column: 2;
    grid-row: 2;
    align-self: end;
  }

  .shop-service-items .shop-service-item {
    min-height: 120px;
  }
}

/* Used for top-of-deck drafts, retained cards, and replacing a full Legacy slot. */
#legacyChoiceOverlay {
  z-index: 180;
  padding: clamp(12px, 2vw, 24px);
  background: rgba(4, 5, 4, 0.86);
  backdrop-filter: blur(4px);
}

.legacy-choice-panel {
  display: grid;
  width: min(1320px, 100%);
  max-height: calc(100vh - 32px);
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.55);
  padding: clamp(14px, 2vw, 24px);
  background:
    radial-gradient(circle at 50% 0%, rgba(242, 193, 78, 0.1), transparent 42%),
    var(--panel-2);
}

#legacyChoiceOverlay.hand-visible-choice {
  align-items: start;
  justify-items: center;
  padding: 12px;
  background: transparent;
  backdrop-filter: none;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-panel {
  width: min(720px, 100%);
  max-height: min(246px, calc(42vh - 8px));
  gap: 9px;
  padding: 12px 14px;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-header p {
  margin-top: 3px;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

#legacyChoiceOverlay.hand-visible-five-choice .legacy-choice-panel {
  width: min(1180px, 100%);
}

#legacyChoiceOverlay.hand-visible-five-choice .legacy-choice-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-option {
  min-height: 124px;
  grid-template-columns: 78px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  align-items: center;
  gap: 6px;
  padding: 8px;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-portrait {
  width: 78px;
  grid-row: 1 / 3;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-option strong {
  text-align: left;
}

#legacyChoiceOverlay.hand-visible-wide-choice .legacy-choice-panel {
  width: min(1180px, 100%);
  max-height: min(274px, calc(46vh - 8px));
}

#legacyChoiceOverlay.hand-visible-wide-choice .legacy-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
}

#legacyChoiceOverlay.hand-visible-wide-choice .legacy-choice-option {
  min-height: 138px;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 5px 7px;
  padding: 7px;
}

#legacyChoiceOverlay.hand-visible-wide-choice .legacy-choice-portrait {
  width: 68px;
}

#legacyChoiceOverlay.hand-visible-wide-choice .card-status {
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-option:has(.legacy-choice-note) {
  grid-template-rows: auto auto auto;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-option:has(.legacy-choice-note) .legacy-choice-portrait {
  grid-row: 1 / span 3;
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-note {
  grid-column: 2;
  margin: 0;
}

.legacy-choice-header {
  min-width: 0;
  margin: 0;
}

.legacy-choice-header h2 {
  color: #fff1bd;
}

.legacy-choice-header p {
  max-width: 900px;
  margin-top: 6px;
  color: #ded9c6;
  text-wrap: pretty;
}

.legacy-choice-selection-status {
  min-width: 92px;
  border: 1px solid rgba(242, 193, 78, 0.42);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(242, 193, 78, 0.08);
  color: #fff1bd;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.legacy-choice-grid {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
  align-items: stretch;
  gap: clamp(9px, 1vw, 14px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 2px 4px 4px 2px;
  scrollbar-gutter: stable;
}

#legacyChoiceOverlay.boss-reward-choice {
  inset: 0;
  place-items: stretch;
  overflow: hidden;
  padding: 0;
  background: var(--panel-2);
  backdrop-filter: none;
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  padding: clamp(16px, 2vw, 30px);
  box-shadow: none;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss {
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  border-color: rgba(255, 155, 130, 0.62);
  padding: 10px 12px;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss-portrait {
  width: 64px;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-name,
#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-ability-name,
#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-description {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-description {
  font-size: 0.8rem;
  line-height: 1.35;
  text-wrap: pretty;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open,
#deckOverlay.boss-reward-deck-view-overlay,
#shopInventoryOverlay.boss-reward-inventory-review {
  --boss-reward-review-height: 44vh;
}

/* Boss rewards stay clickable above the docked Deck or Inventory review. */
#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open {
  bottom: var(--boss-reward-review-height);
  align-items: stretch;
  overflow: hidden;
  padding: clamp(8px, 1.2vw, 14px);
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  gap: 8px;
  padding: clamp(10px, 1.4vw, 16px);
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-header h2 {
  font-size: 1.2rem;
  line-height: 1.2;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-header p {
  margin-top: 2px;
  font-size: 0.76rem;
  line-height: 1.25;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .boss-reward-next-boss {
  grid-template-columns: 44px minmax(0, 1fr);
  padding: 5px 8px;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .boss-reward-next-boss-portrait {
  width: 44px;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .boss-reward-next-boss .shop-upcoming-boss-description {
  font-size: 0.68rem;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-grid {
  min-height: 0;
  align-items: start;
  overflow-y: auto;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-enhancement-reward {
  height: max-content;
  min-height: 0;
  gap: 5px;
  padding: 8px;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-portrait {
  width: min(100%, 84px);
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .legacy-choice-note {
  min-height: 0;
  overflow-y: auto;
}

#deckOverlay.boss-reward-deck-view-overlay,
#shopInventoryOverlay.boss-reward-inventory-review {
  inset: auto 0 0;
  width: auto;
  height: var(--boss-reward-review-height);
  place-items: stretch;
  padding: 0;
  background: transparent;
  backdrop-filter: none;
}

#deckOverlay.boss-reward-deck-view-overlay {
  z-index: 210;
}

#shopInventoryOverlay.boss-reward-inventory-review {
  z-index: 220;
}

#deckOverlay.boss-reward-deck-view-overlay .codex-panel,
#shopInventoryOverlay.boss-reward-inventory-review .shop-inventory-panel {
  width: 100%;
  height: 100%;
  max-height: none;
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.58);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.52);
}

#deckOverlay.boss-reward-deck-view-overlay .codex-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#deckOverlay.boss-reward-deck-view-overlay .deck-grid {
  display: grid;
  min-height: 0;
  max-height: none;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  grid-auto-rows: minmax(126px, calc((100% - 10px) / 2));
  align-content: start;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: auto;
}

#deckOverlay.boss-reward-deck-view-overlay .deck-grid > .codex-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 280px));
  justify-content: center;
  gap: clamp(12px, 1.6vw, 20px);
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-enhancement-reward {
  grid-template-rows: auto auto auto 1fr;
  min-height: 300px;
  border-color: rgba(255, 226, 116, 0.58);
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.13), transparent 56%),
    #191a14;
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-portrait {
  width: min(100%, 156px);
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-enhancement-reward > strong {
  display: flex;
  min-height: calc(var(--card-ui-name-lines) * 1.3em);
  align-items: center;
  justify-content: center;
  gap: 4px;
}

#legacyChoiceOverlay.boss-reward-choice .card-status {
  justify-self: center;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-details {
  display: grid;
  align-self: start;
  width: 100%;
  gap: 6px;
  margin-top: 4px;
  border: 1px solid rgba(255, 226, 116, 0.4);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(10, 10, 8, 0.9);
  text-align: left;
  white-space: normal;
  overflow: visible;
  visibility: hidden;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

#legacyChoiceOverlay.boss-reward-choice
  .legacy-choice-enhancement-reward:is(:hover, :focus-visible)
  .boss-reward-enhancement-details {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-name {
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1.35;
}

#legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-description {
  color: #fff9e5;
  font-size: 0.82rem;
  line-height: 1.5;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open
  .legacy-choice-enhancement-reward > strong {
  min-height: auto;
  font-size: 0.82rem;
  line-height: 1.25;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .card-status {
  --person-card-meta-height: 20px;
}

/* The compact 20px panels cannot fit the normal 6px vertical padding plus text. */
#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open .card-field {
  padding-block: 0;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open
  .boss-reward-enhancement-details {
  gap: 3px;
  margin-top: 2px;
  padding: 6px 8px;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open
  .boss-reward-enhancement-name {
  font-size: 0.76rem;
  line-height: 1.2;
}

#legacyChoiceOverlay.boss-reward-choice.boss-reward-review-open
  .boss-reward-enhancement-description {
  font-size: 0.72rem;
  line-height: 1.35;
}

#legacyChoiceOverlay.boss-reward-choice .legacy-choice-note {
  align-self: stretch;
  color: #f4ecd1;
  white-space: normal;
}

.legacy-choice-option,
.legacy-choice-card,
.legacy-choice-grid > button {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 240px;
  align-content: start;
  gap: 9px;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.34);
  border-radius: 10px;
  padding: 10px;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.07), transparent 52%),
    #171812;
  color: var(--text);
  text-align: left;
  cursor: var(--cursor-default);
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    background 140ms ease;
}

.legacy-choice-option:hover:not(:disabled),
.legacy-choice-option:focus-visible:not(:disabled),
.legacy-choice-card:hover,
.legacy-choice-card:focus-visible,
.legacy-choice-grid > button:hover:not(:disabled),
.legacy-choice-grid > button:focus-visible:not(:disabled) {
  transform: translateY(-3px);
  border-color: #ffe274;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.14), transparent 56%),
    #1d1e18;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34), 0 0 18px rgba(242, 193, 78, 0.12);
}

.legacy-choice-option.is-selected {
  border-color: #ffe274;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.24), transparent 60%),
    #232218;
  box-shadow:
    inset 0 0 0 2px rgba(255, 226, 116, 0.5),
    0 10px 28px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(242, 193, 78, 0.2);
}

.legacy-choice-option.is-selected::after {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #f2c14e;
  color: #171006;
  content: "✓";
  font-size: 1rem;
  font-weight: 1000;
}

.legacy-choice-note {
  margin: 0;
  border: 1px solid rgba(207, 201, 179, 0.2);
  border-radius: 6px;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.045);
  color: #ded9c6;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.35;
  text-wrap: pretty;
}

.legacy-choice-option:disabled .legacy-choice-note {
  color: #f0ead4;
}

.legacy-choice-option:not(:disabled) .legacy-choice-note {
  border-color: rgba(242, 193, 78, 0.36);
  color: #ffe274;
}

.legacy-choice-card-portrait,
.legacy-choice-portrait,
.legacy-choice-option .shop-card-portrait,
.legacy-choice-option .codex-card-portrait {
  display: grid;
  width: min(100%, 168px);
  aspect-ratio: 3 / 4;
  place-items: center;
  justify-self: center;
  overflow: hidden;
  border: 1px solid #5d5541;
  border-radius: 8px;
  background: var(--accent, #8b6f47);
}

.legacy-choice-card-portrait img,
.legacy-choice-portrait img,
.legacy-choice-option .shop-card-portrait img,
.legacy-choice-option .codex-card-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.legacy-choice-option strong,
.legacy-choice-card strong {
  color: #fff1bd;
  font-size: 0.95rem;
  line-height: 1.3;
  text-align: center;
  text-wrap: balance;
}

.legacy-choice-effect,
.legacy-choice-option > span:not(.legacy-choice-icon):not(.legacy-choice-portrait):not(.card-status):not(.legacy-choice-sale-value):not(.legacy-choice-note),
.legacy-choice-option p,
.legacy-choice-card p {
  margin: 0;
  color: #d0cbb9;
  font-size: 0.8rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.legacy-choice-legacy-icon,
.legacy-choice-icon {
  display: grid;
  width: 74px;
  height: 74px;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(242, 193, 78, 0.55);
  border-radius: 18px;
  background: rgba(242, 193, 78, 0.12);
  color: #fff0b1;
  font-size: 2.1rem;
  font-weight: 1000;
  box-shadow: inset 0 0 20px rgba(242, 193, 78, 0.08);
}

.legacy-choice-shop-sale {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.legacy-choice-grid.shop-sale-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 250px));
  justify-content: center;
}

.legacy-choice-shop-sale.is-event {
  border-color: rgba(94, 207, 215, 0.48);
  background:
    linear-gradient(145deg, rgba(94, 207, 215, 0.09), transparent 52%),
    #151a17;
}

.legacy-choice-shop-sale.is-event .legacy-choice-icon {
  border-color: rgba(94, 207, 215, 0.58);
  background: rgba(94, 207, 215, 0.12);
  color: #baf8ff;
  box-shadow: inset 0 0 20px rgba(94, 207, 215, 0.09);
}

.legacy-choice-option > .legacy-choice-sale-value {
  align-self: end;
  width: 100%;
  border: 1px solid rgba(242, 193, 78, 0.58);
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #f6b749, #ca761f);
  color: #171006;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
}

@media (max-width: 980px) {
  .legacy-panel {
    grid-column: 1 / -1;
  }

  .legacy-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: minmax(96px, max-content);
  }

  .shop-secondary-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .shop-grid {
    height: auto;
    grid-template-rows: auto auto;
  }

  .shop-legacy-items,
  .shop-event-items {
    min-height: 210px;
  }

  .shop-legacy-items > .shop-item,
  .shop-event-items > .shop-item,
  .shop-legacy-item,
  .shop-event-item {
    height: auto;
    min-height: 210px;
  }
}

@media (max-width: 720px) {
  .game-speed-setting {
    align-items: stretch !important;
    flex-direction: column;
  }

  .game-speed-control {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(104px, auto);
  }

  .legacy-list,
  .shop-person-items,
  .shop-event-items {
    grid-template-columns: minmax(0, 1fr);
  }

  .legacy-list {
    grid-template-rows: repeat(3, minmax(96px, max-content));
  }

  .legacy-choice-header {
    align-items: stretch;
  }

  #legacyChoiceCancelButton {
    width: 100%;
  }

  #legacyChoiceConfirmButton,
  .legacy-choice-selection-status {
    width: 100%;
  }

  .legacy-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #legacyChoiceOverlay.boss-reward-choice .legacy-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: center;
  }

  .legacy-choice-option,
  .legacy-choice-card,
  .legacy-choice-grid > button {
    min-height: 210px;
  }
}

@media (max-width: 480px) {
  .legacy-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #legacyChoiceOverlay.boss-reward-choice .legacy-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-height: 760px) and (min-width: 981px) {
  .legacy-list {
    grid-template-rows: repeat(3, minmax(88px, max-content));
  }

  .legacy-slot,
  .legacy-chip,
  .legacy-list > .collection-chip,
  .legacy-list > .collection-empty,
  .legacy-slot-empty,
  .legacy-slot.is-empty {
    min-height: 88px;
    padding-block: 6px;
  }

.legacy-panel .legacy-description,
  .legacy-slot p,
  .legacy-chip p,
  .legacy-list > .collection-chip span {
    -webkit-line-clamp: unset;
  }

  .shop-panel {
    padding: 10px 14px;
  }

  .shop-grid {
    gap: 8px;
  }

  .shop-panel .section-heading {
    margin-bottom: 4px;
  }

  .shop-secondary-row {
    gap: 10px;
  }
}

/* Final responsive shop rules stay last so older component breakpoints cannot undo them. */
@media (max-width: 980px) {
  #shopOverlay {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .shop-panel {
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .shop-panel .shop-header {
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  .shop-toolbar {
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .shop-grid {
    height: auto;
    grid-template-rows: auto auto;
  }

  .shop-person-items {
    height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-grid .shop-card-item {
    min-height: 300px;
  }

  .shop-secondary-row {
    height: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .shop-legacy-section,
  .shop-event-section {
    grid-column: auto;
  }

  .shop-legacy-section > .shop-legacy-items,
  .shop-event-section > .shop-event-items,
  .shop-legacy-item,
  .shop-event-item {
    height: auto;
    min-height: 230px;
  }

  .shop-event-section > .shop-event-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-services {
    grid-template-columns: minmax(0, 1fr);
  }

  .shop-service-items {
    grid-column: 1;
  }
}

.sentence-break-description.sentence-break-description {
  white-space: pre-line;
}

@media (max-width: 720px) {
  .shop-panel {
    padding: 12px;
  }

  .shop-toolbar,
  .shop-panel .modal-actions {
    width: 100%;
  }

  .shop-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .shop-panel .shop-money {
    align-self: flex-start;
  }

  .shop-panel .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shop-person-items,
  .shop-event-section > .shop-event-items,
  .shop-service-items {
    grid-template-columns: minmax(0, 1fr);
  }

  .shop-grid .shop-card-item {
    min-height: 280px;
  }

  .shop-grid .shop-card-portrait {
    max-height: 260px;
  }
}

@media (min-width: 981px) and (max-height: 760px) {
  .shop-panel {
    --shop-column-gap: 9px;
    --shop-row-gap: 8px;
    --shop-card-padding: 9px;
    padding: 10px 14px;
  }

  .shop-panel .shop-header {
    gap: 14px;
    padding-bottom: 6px;
  }

  .shop-upcoming-boss {
    grid-template-columns: 42px minmax(0, 1fr);
    padding: 5px 8px;
  }

  .shop-upcoming-boss-portrait {
    width: 42px;
  }

  .shop-panel .shop-heading-copy h2 {
    font-size: 1.35rem;
  }

  .shop-toolbar {
    gap: 8px;
  }

  .shop-panel .shop-money,
  .shop-panel .modal-actions .secondary-button {
    min-height: 38px;
  }

  .shop-panel .shop-money {
    min-width: 86px;
    padding-inline: 12px;
  }

  .shop-panel .shop-money strong {
    font-size: 1.12rem;
  }

  .shop-panel .modal-actions .secondary-button {
    padding-inline: 11px;
    font-size: 0.84rem;
  }

  .shop-grid {
    grid-template-rows: minmax(250px, 1fr) 210px;
  }

  .shop-panel .section-heading {
    min-height: 18px;
    margin-bottom: 4px;
    font-size: 0.74rem;
  }

  .shop-panel .shop-item {
    gap: 7px;
  }

  .shop-grid .shop-card-item {
    gap: 7px;
  }

  .shop-grid .shop-card-layout {
    column-gap: 10px;
    row-gap: 7px;
  }

  .shop-grid .shop-card-portrait {
    max-height: 100%;
  }

  .shop-grid .shop-card-copy h3 {
    font-size: 0.94rem;
  }

  .shop-panel .shop-card-item .shop-item-footer .price-button,
  .shop-panel .shop-legacy-item .shop-item-footer .price-button,
  .shop-panel .shop-event-item .shop-item-footer .price-button {
    width: 94px;
    height: 40px;
    min-width: 94px;
    min-height: 40px;
    padding-inline: 13px;
    font-size: 0.9rem;
  }

  .shop-legacy-item,
  .shop-event-item {
    grid-template-rows: 2.75rem minmax(0, 1fr) auto;
  }

  .shop-legacy-title-row,
  .shop-secondary-row .shop-event-item > h3 {
    min-height: 2.75rem;
  }

  .shop-legacy-item .shop-legacy-icon {
    flex-basis: 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 2.2rem;
  }

  .shop-secondary-row .shop-legacy-item h3,
  .shop-secondary-row .shop-event-item h3 {
    font-size: 0.94rem;
  }

  .shop-legacy-owner {
    font-size: 0.7rem;
  }

  .shop-offer-description {
    font-size: 0.78rem;
    line-height: 1.4;
    -webkit-line-clamp: 3;
  }

  .shop-service-items .shop-service-item {
    min-height: 101px;
    padding: 7px 9px;
  }

  .shop-service-items .shop-service-item h3 {
    font-size: 0.92rem;
  }

  .shop-service-items .shop-service-item .price-button {
    min-width: 94px;
    min-height: 40px;
    padding-inline: 12px;
    font-size: 0.88rem;
  }
}

@media (min-width: 981px) and (max-height: 700px) {
  .shop-grid {
    grid-template-rows: minmax(230px, 1fr) 200px;
  }
}

/* In-run Legacies stay compact; their full effect is revealed beside the icon. */
.left-panel {
  position: relative;
  z-index: 35;
  overflow: visible;
}

.legacy-panel.collection-panel {
  flex: 0 0 auto;
  overflow: visible;
}

.legacy-list.collection-list {
  display: flex;
  flex: 0 0 auto;
  min-height: 46px;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  overflow: visible;
  padding-right: 0;
  scrollbar-gutter: auto;
}

.legacy-list > .legacy-slot {
  position: relative;
  display: block;
  width: 46px;
  height: 46px;
  min-width: 46px;
  min-height: 46px;
  flex: 0 0 46px;
  overflow: visible;
  border: 0;
  border-radius: 9px;
  padding: 0;
  background: transparent;
  cursor: help;
}

.legacy-list > .legacy-slot.has-memory-targets {
  width: 82px;
  flex-basis: 82px;
}

.legacy-list > .legacy-slot.has-memory-targets.memory-count-2 {
  width: 112px;
  flex-basis: 112px;
}

.legacy-memory-targets {
  position: absolute;
  top: 3px;
  left: 53px;
  display: flex;
  gap: 3px;
  height: 40px;
  align-items: center;
  pointer-events: none;
}

.legacy-memory-target {
  display: block;
  width: 26px;
  height: 38px;
  overflow: hidden;
  border: 1px solid rgba(242, 193, 78, 0.5);
  border-radius: 5px;
  background: #11130f;
  box-shadow: 0 5px 12px rgba(0, 0, 0, 0.32);
}

.legacy-memory-target img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}

.legacy-memory-target.is-highlighted {
  border-color: #ffe274;
  box-shadow: 0 0 0 2px rgba(255, 226, 116, 0.2), 0 0 15px rgba(242, 193, 78, 0.5);
  transform: translateY(-2px);
}

.legacy-list > .legacy-slot .legacy-slot-icon {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(242, 193, 78, 0.56);
  border-radius: 9px;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.22), rgba(242, 193, 78, 0.06)),
    #151610;
  color: #fff0b1;
  font-size: 1.8rem;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
}

.legacy-list > .legacy-slot[data-owner-enhanced="true"] .legacy-slot-icon {
  border-color: #ffe274;
  box-shadow:
    0 0 0 2px rgba(255, 226, 116, 0.14),
    0 0 18px rgba(242, 193, 78, 0.3);
}

.legacy-list > .legacy-slot.is-boss-sealed .legacy-slot-icon {
  filter: grayscale(1);
  opacity: 0.38;
  border-color: rgba(210, 210, 210, 0.28);
  box-shadow: none;
}

.legacy-list > .legacy-slot .legacy-hover-panel {
  position: absolute;
  top: 0;
  left: calc(100% + 8px);
  z-index: 90;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: clamp(220px, 22vw, 330px);
  max-width: calc(100vw - 100px);
  gap: 7px;
  visibility: hidden;
  border: 1px solid rgba(242, 193, 78, 0.62);
  border-radius: 9px;
  padding: 11px 13px;
  background: rgba(13, 14, 11, 0.98);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateX(6px);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    visibility 0s linear 120ms;
}

.legacy-list > .legacy-slot:hover .legacy-hover-panel,
.legacy-list > .legacy-slot:focus .legacy-hover-panel,
.legacy-list > .legacy-slot:focus-within .legacy-hover-panel {
  visibility: visible;
  opacity: 1;
  transform: translateX(0);
  transition-delay: 0s;
}

.legacy-list > .legacy-slot .legacy-hover-panel > strong {
  grid-column: 1;
  display: block;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  margin: 0;
  color: var(--gold);
  font-size: 0.9rem;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: normal;
}

.legacy-list > .legacy-slot .legacy-hover-panel > .legacy-description {
  grid-column: 1;
  display: block;
  justify-self: stretch;
  width: 100%;
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.45;
  text-align: left;
  text-wrap: pretty;
}

.legacy-list > .legacy-slot[data-owner-enhanced="true"] .legacy-hover-panel > .legacy-description {
  color: #ffe274;
  font-weight: 900;
}

/* ANTE opening route: two rounds lead into the featured central boss. */
.ante-map-overlay {
  z-index: 135;
  overflow: auto;
  padding: clamp(18px, 4vh, 48px) clamp(16px, 4vw, 64px);
  background:
    radial-gradient(circle at 82% 18%, rgba(112, 166, 216, 0.13), transparent 28%),
    radial-gradient(circle at 18% 78%, rgba(242, 193, 78, 0.12), transparent 30%),
    #050605;
}

.ante-map-panel {
  position: relative;
  display: grid;
  width: min(1380px, 100%);
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(24px, 4vh, 46px);
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.42);
  padding: clamp(24px, 4vw, 52px);
  background:
    linear-gradient(135deg, rgba(242, 193, 78, 0.06), transparent 36%),
    var(--panel-2);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.58),
    inset 0 1px rgba(255, 255, 255, 0.035);
}

.ante-map-panel::before {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(242, 193, 78, 0.13);
  border-radius: calc(var(--radius) - 2px);
  content: "";
  pointer-events: none;
}

.ante-map-header {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 7px;
  text-align: center;
}

.ante-map-kicker {
  color: var(--gold);
  font-size: clamp(0.8rem, 1.15vw, 0.98rem);
  font-weight: 1000;
  letter-spacing: 0.18em;
}

.ante-map-route {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(150px, 0.78fr) minmax(150px, 0.78fr) minmax(430px, 2.2fr);
  align-items: center;
  gap: clamp(42px, 5vw, 78px);
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ante-map-route::before {
  position: absolute;
  top: 50%;
  right: 8%;
  left: 8%;
  z-index: -1;
  height: 3px;
  background: linear-gradient(90deg, var(--gold), rgba(242, 193, 78, 0.32) 58%, rgba(213, 87, 87, 0.72));
  box-shadow: 0 0 14px rgba(242, 193, 78, 0.18);
  content: "";
  transform: translateY(-50%);
}

.ante-map-stop {
  min-width: 0;
}

.ante-map-round-stop {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.ante-map-node {
  position: relative;
  display: grid;
  width: clamp(138px, 13vw, 190px);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(242, 193, 78, 0.48);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(242, 193, 78, 0.16), rgba(242, 193, 78, 0.025)),
    #11120f;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.34);
}

.ante-map-round-stop.is-current .ante-map-node {
  border-color: var(--gold);
  box-shadow:
    0 0 0 5px rgba(242, 193, 78, 0.1),
    0 0 28px rgba(242, 193, 78, 0.18),
    0 18px 36px rgba(0, 0, 0, 0.4);
}

.ante-map-node-number {
  color: #fff0b1;
  font-size: clamp(3rem, 6vw, 5.3rem);
  font-weight: 1000;
  line-height: 1;
}

.ante-map-node-mark {
  position: absolute;
  right: 12px;
  bottom: 8px;
  color: rgba(242, 193, 78, 0.34);
  font-size: 1.15rem;
}

.ante-map-stop-copy {
  display: grid;
  justify-items: center;
  gap: 2px;
  border: 1px solid rgba(242, 193, 78, 0.26);
  border-radius: 999px;
  padding: 7px 18px 8px;
  background: rgba(12, 13, 11, 0.94);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}

.ante-map-stop-kind {
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.11em;
  line-height: 1.15;
}

.ante-map-stop-copy strong {
  color: var(--text);
  font-size: clamp(0.9rem, 1.15vw, 1.05rem);
}

.ante-map-boss-stop {
  display: grid;
  grid-template-columns: clamp(150px, 14vw, 210px) minmax(210px, 1fr);
  align-items: center;
  gap: clamp(16px, 2vw, 28px);
  min-width: 0;
  border: 1px solid rgba(213, 87, 87, 0.48);
  border-radius: 20px;
  padding: clamp(12px, 1.5vw, 18px);
  background:
    linear-gradient(120deg, rgba(213, 87, 87, 0.13), rgba(242, 193, 78, 0.035)),
    rgba(12, 13, 11, 0.97);
  box-shadow:
    0 0 26px rgba(213, 87, 87, 0.11),
    0 22px 48px rgba(0, 0, 0, 0.42);
}

.ante-map-boss-card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 13px;
  background: #0d0e0b;
  box-shadow:
    0 0 0 4px rgba(242, 193, 78, 0.1),
    0 16px 32px rgba(0, 0, 0, 0.48);
}

.ante-map-boss-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.ante-map-boss-name {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 28px 6px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.96));
  color: #fff;
  font-size: clamp(0.68rem, 1vw, 0.94rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
  text-shadow: 0 2px 5px #000;
}

/* Keep name groups together when they fit; allow long groups to wrap inside the portrait. */
.ante-map-boss-name .enemy-card-name-part {
  display: inline-block;
  max-width: 100%;
  text-wrap: balance;
  white-space: normal;
}

.ante-map-boss-copy {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 8px;
}

.ante-map-boss-copy .ante-map-stop-kind {
  color: #ff8d82;
}

.ante-map-boss-copy h3 {
  margin: 0;
  color: #ffe274;
  font-size: clamp(1.2rem, 2vw, 1.75rem);
  line-height: 1.2;
  overflow-wrap: normal;
}

.ante-map-boss-copy p {
  max-width: 42ch;
  color: var(--text);
  font-size: clamp(0.88rem, 1.15vw, 1.05rem);
  font-weight: 700;
  line-height: 1.65;
  text-wrap: pretty;
}

.ante-map-actions {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.ante-map-start-button {
  min-width: min(300px, 100%);
  min-height: 56px;
  padding-inline: 36px;
  font-size: 1.12rem;
  box-shadow: 0 14px 30px rgba(184, 101, 46, 0.28);
}

@media (max-width: 980px) {
  .ante-map-panel {
    overflow: auto;
  }

  .ante-map-route {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
    align-items: start;
  }

  .ante-map-route::before {
    top: clamp(69px, 13vw, 95px);
    right: 24%;
    left: 24%;
    transform: none;
  }

  .ante-map-boss-stop {
    grid-column: 1 / -1;
    width: min(620px, 100%);
    margin-inline: auto;
  }
}

@media (max-width: 620px) {
  .ante-map-overlay {
    place-items: start center;
    padding: 10px;
  }

  .ante-map-panel {
    gap: 22px;
    padding: 22px 16px;
  }

  .ante-map-route {
    gap: 28px 16px;
  }

  .ante-map-node {
    width: min(132px, 36vw);
  }

  .ante-map-route::before {
    top: min(66px, 18vw);
  }

  .ante-map-boss-stop {
    grid-template-columns: minmax(105px, 0.72fr) minmax(150px, 1.28fr);
    gap: 13px;
    border-radius: 14px;
    padding: 10px;
  }

  .ante-map-boss-copy {
    gap: 5px;
  }

  .ante-map-boss-copy h3 {
    font-size: 1rem;
  }

  .ante-map-boss-copy p {
    font-size: 0.78rem;
    line-height: 1.45;
  }
}

@media (max-height: 720px) and (min-width: 981px) {
  .ante-map-overlay {
    padding-block: 14px;
  }

  .ante-map-panel {
    gap: 18px;
    padding-block: 22px;
  }

  .ante-map-node {
    width: min(150px, 20vh);
  }

  .ante-map-boss-stop {
    grid-template-columns: min(145px, 22vh) minmax(210px, 1fr);
  }

  .ante-map-start-button {
    min-height: 48px;
  }
}

/* Keep the flag and every field panel optically aligned on all person-card surfaces. */
.card-status {
  --person-card-meta-height: 28px;
}

.card-status > .country-flag,
.card-status > .card-meta-details > .card-fields > .card-field {
  height: var(--person-card-meta-height);
  min-height: var(--person-card-meta-height);
  max-height: var(--person-card-meta-height);
}

.card-status > .card-meta-details > .card-fields > .card-field {
  display: grid;
  align-items: center;
  line-height: 1.1;
}

.enemy-card .card-status .card-era {
  min-height: 16px;
  padding: 1px 5px;
  font-size: 0.56rem;
}

.enemy-card .card-status {
  --person-card-meta-height: 20px;
}

.person-card .card-status {
  --person-card-meta-height: 28px;
}

/* Shop portraits use a wider 3:2 flag instead of the near-square shared size. */
.shop-card-status > .country-flag {
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
}

@media (max-height: 760px) {
  .person-card .card-status {
    --person-card-meta-height: 24px;
  }
}

@media (min-width: 1200px) and (min-height: 800px) {
  .shop-card-status {
    --person-card-meta-height: 36px;
  }

  .shop-card-status > .country-flag {
    flex-basis: 54px;
    width: 54px;
    min-width: 54px;
    max-width: 54px;
  }
}

/* Unified card layout system */
:root {
  --card-ui-space-1: 4px;
  --card-ui-space-2: 8px;
  --card-ui-space-3: 12px;
  --card-ui-space-4: 16px;
  --card-ui-portrait-ratio: 3 / 4;
  --card-ui-flag-ratio: 3 / 2;
  --card-ui-name-lines: 2;
  --card-ui-meta-gap: var(--card-ui-space-2);
}

/* Every person surface follows portrait -> name -> metadata -> detail -> action. */
.card-status,
.codex-card > .card-status,
.legacy-choice-option > .card-status,
.legacy-choice-card > .card-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  align-self: start;
  gap: var(--card-ui-meta-gap);
  width: 100%;
  min-width: 0;
  margin: 0;
}

.card-status:not(:has(> .country-flag)) {
  grid-template-columns: minmax(0, 1fr);
}

.card-status > .country-flag {
  width: calc(var(--person-card-meta-height, 28px) * 1.5);
  min-width: calc(var(--person-card-meta-height, 28px) * 1.5);
  max-width: calc(var(--person-card-meta-height, 28px) * 1.5);
  aspect-ratio: var(--card-ui-flag-ratio);
  margin: 0;
}

.card-status > .card-meta-details,
.codex-card .card-meta-details {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: var(--card-ui-meta-gap);
  min-width: 0;
  margin: 0;
}

.card-meta-details {
  align-content: start;
  gap: var(--card-ui-meta-gap);
}

.card-status > .card-meta-details > .card-fields,
.codex-card .card-fields {
  display: flex;
  min-width: 0;
  align-items: stretch;
  flex-wrap: wrap;
  gap: var(--card-ui-space-1);
  margin: 0;
}

.card-status > .card-meta-details > .card-fields > .card-field,
.codex-card .card-field {
  flex: 0 0 auto;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

#deckOverlay .codex-card .card-fields > .card-field,
#cardZoneViewerOverlay .codex-card .card-fields > .card-field {
  display: grid;
  place-items: center;
  padding-inline: 6px;
  text-align: center;
}

.card-status > .card-meta-details > .card-era,
.codex-card .card-era {
  width: fit-content;
  max-width: 100%;
  height: auto;
  min-height: 20px;
  margin: 0;
  overflow-wrap: normal;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

/* Deck-review cards keep century ranges on one line; wider automatic columns
   provide enough room without changing compact hand, enemy, or shop cards. */
#deckOverlay .deck-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
}

#cardZoneViewerOverlay .card-zone-viewer-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
}

#deckOverlay .codex-card .card-era,
#cardZoneViewerOverlay .codex-card .card-era {
  max-width: 100%;
  padding-inline: 4px;
  overflow-wrap: normal;
  word-break: keep-all;
  white-space: nowrap;
  font-size: clamp(0.54rem, 0.7vw, 0.62rem);
}

/* Compact deck metadata uses the space below the flag for the Era. When two
   Fields wrap, the Era therefore stays inside the fixed-height review card. */
#deckOverlay .codex-card > .card-status,
#cardZoneViewerOverlay .codex-card > .card-status {
  grid-template-rows: auto auto;
  row-gap: var(--card-ui-space-1);
}

#deckOverlay .codex-card > .card-status > .country-flag,
#cardZoneViewerOverlay .codex-card > .card-status > .country-flag {
  grid-column: 1;
  grid-row: 1;
}

#deckOverlay .codex-card > .card-status > .card-meta-details,
#cardZoneViewerOverlay .codex-card > .card-status > .card-meta-details {
  display: contents;
}

#deckOverlay .codex-card > .card-status .card-fields,
#cardZoneViewerOverlay .codex-card > .card-status .card-fields {
  grid-column: 2;
  grid-row: 1 / 3;
  align-self: start;
}

#deckOverlay .codex-card > .card-status .card-era,
#cardZoneViewerOverlay .codex-card > .card-status .card-era {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  justify-self: start;
}

/* A wide Era label expands the flag column. Right-align both items in pile
   windows so the visible Flag-to-Field gap remains the grid column gap. */
#cardZoneViewerOverlay .codex-card > .card-status > .country-flag,
#cardZoneViewerOverlay .codex-card > .card-status .card-era {
  justify-self: end;
}

/* In the shop, Deck Review uses the lower half of the screen. The shop itself
   ends above the dock, so merchandise always remains visible and clickable. */
#shopOverlay.shop-deck-review-open,
#deckOverlay.shop-deck-view-overlay {
  --shop-deck-review-height: 50vh;
}

#shopOverlay.shop-deck-review-open {
  bottom: var(--shop-deck-review-height);
  overflow: hidden;
}

#shopOverlay.shop-deck-review-open .shop-panel {
  height: auto;
  min-height: 100%;
  grid-template-rows: auto auto auto;
  align-content: start;
  overflow-x: hidden;
  overflow-y: auto;
}

#shopOverlay.shop-deck-review-open .shop-grid {
  --shop-deck-people-height: clamp(220px, calc(50vh - 136px), 300px);
  --shop-deck-secondary-height: clamp(210px, 27vh, 280px);
  height: calc(
    var(--shop-deck-people-height)
    + var(--shop-deck-secondary-height)
    + var(--shop-row-gap)
  );
  min-height: calc(
    var(--shop-deck-people-height)
    + var(--shop-deck-secondary-height)
    + var(--shop-row-gap)
  );
  grid-template-rows:
    var(--shop-deck-people-height)
    var(--shop-deck-secondary-height);
}

#deckOverlay.shop-deck-view-overlay {
  inset: auto 0 0;
  z-index: 230;
  width: auto;
  height: var(--shop-deck-review-height);
  place-items: stretch;
  padding: 0;
  background: transparent;
}

#deckOverlay.shop-deck-view-overlay .codex-panel {
  display: grid;
  width: 100%;
  height: 100%;
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border-color: rgba(242, 193, 78, 0.58);
  box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.52);
}

#deckOverlay.shop-deck-view-overlay .deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr));
  grid-auto-rows: minmax(126px, calc((100% - 10px) / 2));
  align-content: start;
  align-items: stretch;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 4px 4px 0;
}

#deckOverlay.shop-deck-view-overlay .deck-grid > .codex-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

#deckOverlay.shop-deck-view-overlay .deck-grid > .codex-card-enhanced {
  overflow: hidden;
}

.card-enhancement-side-tooltip {
  position: fixed;
  z-index: 1200;
  display: grid;
  box-sizing: border-box;
  width: 0;
  height: 0;
  max-height: none;
  align-content: start;
  gap: clamp(2px, 2.5cqw, 5px);
  visibility: hidden;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(252, 224, 144, 0.88);
  border-radius: 10px;
  padding: clamp(3px, 3.5cqw, 9px);
  background:
    linear-gradient(145deg, rgba(78, 55, 15, 0.9), rgba(18, 18, 14, 0.955)),
    #171812;
  box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(3px);
  color: #fff;
  container-type: inline-size;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: scale(0.985);
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms;
}

.card-enhancement-side-tooltip.is-visible {
  visibility: visible;
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.card-enhancement-side-tooltip-title,
.card-enhancement-side-tooltip-description {
  display: block;
  margin: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.card-enhancement-side-tooltip-title {
  color: var(--gold);
  font-size: clamp(0.5rem, 10cqw, 0.9rem);
  font-weight: 1000;
  line-height: 1.2;
}

.card-enhancement-side-tooltip-description {
  color: #fff;
  font-size: clamp(0.45rem, 8.5cqw, 0.82rem);
  font-weight: 750;
  line-height: 1.3;
  text-wrap: pretty;
}

.card-enhancement-side-tooltip.is-compact {
  gap: 2px;
  border-radius: 6px;
  padding: 3px;
}

/* Pile and Shop Deck Review cards have tiny portraits. Give their effect text
   its own readable panel instead of shrinking it to fit the artwork. */
.card-enhancement-side-tooltip:is(.is-zone-viewer, .is-shop-deck-viewer, .is-deck-removal-viewer) {
  gap: 8px;
  padding: 12px 14px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  overflow-wrap: normal;
}

.card-enhancement-side-tooltip:is(.is-zone-viewer, .is-shop-deck-viewer, .is-deck-removal-viewer) .card-enhancement-side-tooltip-title {
  font-size: 1rem;
  line-height: 1.4;
}

.card-enhancement-side-tooltip:is(.is-zone-viewer, .is-shop-deck-viewer, .is-deck-removal-viewer) .card-enhancement-side-tooltip-description {
  font-size: 1rem;
  line-height: 1.6;
}

@media (max-width: 1100px) {
  #shopOverlay.shop-deck-review-open .shop-grid {
    --shop-deck-people-height: clamp(220px, calc(50vh - 110px), 260px);
  }
}

.person-card .card-name,
.enemy-card .enemy-card-name,
.codex-card > strong,
.legacy-choice-option > strong,
.legacy-choice-card > strong,
.card-workshop-preview > strong,
.marking-target-copy > strong {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: calc(var(--card-ui-name-lines) * 1.2em);
  max-height: none;
  overflow: visible;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-overflow: clip;
  text-wrap: balance;
  white-space: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: unset;
}

/* Long names may extend the reserved title region instead of losing their last line. */
.enemy-card-name {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: calc(var(--card-ui-name-lines) * 1.2em);
  max-height: none;
  overflow: visible;
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-overflow: clip;
  text-wrap: balance;
  white-space: normal;
  word-break: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: unset;
}

.person-card .portrait > img,
.enemy-portrait > img,
.shop-card-portrait > img,
.codex-card-portrait > img,
.legacy-choice-card-portrait > img,
.legacy-choice-portrait > img,
.legacy-choice-option .shop-card-portrait > img,
.legacy-choice-option .codex-card-portrait > img,
.marking-target-portrait > img,
.card-workshop-preview-image > img,
.card-workshop-library-card > img,
.ante-map-boss-card > img,
.legacy-memory-target > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

/* Portrait selectors stay direct and reusable across renderer-specific wrappers. */
.shop-card-portrait,
.codex-card-portrait,
.legacy-choice-portrait,
.marking-target-portrait,
.card-workshop-preview-image,
.card-workshop-library-card > img {
  aspect-ratio: var(--card-ui-portrait-ratio);
}

.person-card .portrait img,
.enemy-portrait img,
.shop-card-portrait img,
.codex-card-portrait img,
.legacy-choice-portrait img,
.marking-target-portrait > img,
.card-workshop-preview-image img,
.card-workshop-library-card > img {
  object-fit: cover;
  object-position: center top;
}

.codex-card-portrait .card-mark-art-layers img,
.shop-card-portrait .card-mark-art-layers img,
.legacy-choice-portrait .card-mark-art-layers img {
  object-fit: fill !important;
}

.codex-card-portrait .card-mark-badge img,
.shop-card-portrait .card-mark-badge img,
.legacy-choice-portrait .card-mark-badge img {
  object-fit: contain;
  object-position: center;
}

/* Hand cards keep every label on the same baseline, regardless of name length. */
.person-card .card-body {
  display: grid;
  grid-template-rows: minmax(calc(var(--card-ui-name-lines) * 1.2em), auto) auto;
  align-content: end;
  align-items: start;
  gap: var(--card-ui-space-1);
  min-height: clamp(90px, 13vh, 110px);
  padding: 10px;
}

.person-card .card-name {
  align-self: end;
  width: 100%;
  text-align: left;
}

.person-card .card-status {
  --person-card-meta-height: 28px;
  align-self: start;
}

/* Enemy cards use the same slots in a compact horizontal variant. */
.enemy-card {
  grid-template-columns: clamp(76px, 38%, 138px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  min-width: 0;
  min-height: 116px;
}

.enemy-card-body {
  display: grid;
  grid-template-rows: minmax(calc(var(--card-ui-name-lines) * 1.2em), auto) auto;
  align-content: start;
  align-items: start;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
}

.enemy-card .enemy-card-name {
  align-self: start;
  font-size: clamp(0.68rem, 0.78vw, 0.8rem);
}

.enemy-card .card-status {
  --person-card-meta-height: 20px;
  align-self: start;
  gap: 6px;
}

.enemy-card .card-fields {
  align-items: flex-start;
  flex-direction: column;
  flex-wrap: nowrap;
}

.enemy-card .card-fields .card-field {
  width: fit-content;
  max-width: 100%;
}

/* Shop card content is top-aligned and the fixed price footer owns the bottom edge. */
.shop-grid .shop-card-copy {
  display: grid;
  grid-template-rows: minmax(calc(var(--card-ui-name-lines) * 1.3em), auto) auto auto;
  align-content: start;
  align-items: start;
  align-self: center;
  gap: var(--card-ui-space-2);
  min-width: 0;
}

.shop-grid .shop-card-copy > h3 {
  min-height: calc(var(--card-ui-name-lines) * 1.3em);
  max-height: none;
  align-content: start;
  align-items: flex-start;
  overflow: visible;
  line-height: 1.3;
  text-wrap: balance;
}

.shop-card-copy h3 {
  min-height: calc(var(--card-ui-name-lines) * 1.3em);
  max-height: none;
  overflow: visible;
  line-height: 1.3;
  text-wrap: balance;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.shop-grid .shop-card-status {
  --person-card-meta-height: 30px;
  align-self: start;
}

.shop-panel .shop-item-footer,
.shop-grid .shop-card-item > .shop-item-footer {
  align-self: end;
}

.shop-grid .shop-card-item {
  grid-template-rows: minmax(0, 1fr) auto;
}

.shop-grid .shop-card-item > .shop-item-footer {
  width: 100%;
  margin-top: auto;
}

.shop-legacy-item,
.shop-event-item {
  align-content: stretch;
}

.shop-legacy-item .shop-offer-description,
.shop-event-item .shop-offer-description {
  align-self: start;
}

@media (min-width: 981px) {
  .shop-grid .shop-card-item {
    grid-template-columns: clamp(144px, 13vw, 184px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    column-gap: var(--card-ui-space-4);
    row-gap: 10px;
  }

  .shop-grid .shop-card-layout {
    display: contents;
  }

  .shop-grid .shop-card-portrait {
    grid-column: 1;
    grid-row: 1 / 3;
    width: 100%;
    height: auto;
    max-width: none;
    max-height: 100%;
    aspect-ratio: var(--card-ui-portrait-ratio);
    align-self: end;
    justify-self: stretch;
  }

  .shop-grid .shop-card-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .shop-grid .shop-card-item > .shop-item-footer {
    grid-column: 2;
    grid-row: 2;
  }
}

/* Deck, draw-pile, removal, enhancement and codex cards share one list layout. */
.codex-grid,
.deck-grid {
  align-items: stretch;
}

.codex-card {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  grid-template-rows: minmax(calc(var(--card-ui-name-lines) * 1.2em), auto) auto auto;
  align-content: start;
  align-items: start;
  gap: var(--card-ui-space-2) 10px;
  min-width: 0;
  min-height: 126px;
  padding: 10px;
}

.codex-card > .codex-card-portrait {
  grid-column: 1;
  grid-row: 1 / 3;
  width: 62px;
  aspect-ratio: var(--card-ui-portrait-ratio);
  align-self: start;
  margin: 0;
}

.codex-card > strong {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  color: var(--text);
  font-size: 0.86rem;
}

.codex-card > .card-status {
  --person-card-meta-height: 24px;
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  gap: 6px;
}

.codex-card > .codex-card-empty-text,
.codex-card > .boss-penalty-rule,
.codex-card > .boss-debuff-rule {
  grid-column: 2;
  grid-row: 2;
  align-self: start;
  margin: 0;
}

.codex-card > .codex-enhancement-title,
.codex-card > .codex-enhancement-description,
.codex-card > .deck-enhancement-ability-name,
.codex-card > .deck-enhancement-ability-description,
.codex-card > .codex-history-button {
  grid-column: 1 / -1;
}

/* Person Codex actions stay on one footer line even when enhancement copy differs. */
.codex-card.codex-person-card {
  grid-template-rows:
    minmax(calc(var(--card-ui-name-lines) * 1.2em), auto)
    auto
    auto
    minmax(0, 1fr)
    auto;
  height: 100%;
}

.codex-card.codex-person-card > .codex-enhancement-title {
  grid-row: 3;
  align-self: start;
}

.codex-card.codex-person-card > .codex-enhancement-description {
  grid-row: 4;
  align-self: start;
}

.codex-card.codex-person-card > .codex-history-button {
  grid-row: 5;
  align-self: end;
  width: 100%;
}

.codex-card .card-meta-details,
.codex-card .card-fields,
.codex-card .card-mark-badges {
  margin-top: 0;
}

/* Choice cards reserve a stable title slot and enough top room for hover lift. */
.legacy-choice-grid {
  align-items: stretch;
  padding: 6px 4px 4px;
}

.legacy-choice-option,
.legacy-choice-card,
.legacy-choice-grid > button {
  align-content: start;
  align-items: start;
  gap: var(--card-ui-space-2);
}

.legacy-choice-card-portrait,
.legacy-choice-portrait,
.legacy-choice-option .shop-card-portrait,
.legacy-choice-option .codex-card-portrait {
  aspect-ratio: var(--card-ui-portrait-ratio);
  align-self: start;
}

.legacy-choice-option > strong,
.legacy-choice-card > strong {
  align-self: start;
}

.legacy-choice-option:hover:not(:disabled),
.legacy-choice-option:focus-visible:not(:disabled),
.legacy-choice-card:hover,
.legacy-choice-card:focus-visible,
.legacy-choice-grid > button:hover:not(:disabled),
.legacy-choice-grid > button:focus-visible:not(:disabled) {
  transform: translateY(-2px);
}

#legacyChoiceOverlay.hand-visible-choice .legacy-choice-option {
  grid-template-rows: minmax(calc(var(--card-ui-name-lines) * 1.2em), auto) auto auto;
  align-content: start;
  align-items: start;
}

/* Marking and workshop previews use the same portrait scale and top alignment. */
.marking-target-card {
  display: grid;
  grid-template-columns: clamp(144px, 15vw, 220px) minmax(0, 1fr);
  align-items: start;
  gap: var(--card-ui-space-4);
}

.marking-target-portrait {
  width: 100%;
  height: auto;
  aspect-ratio: var(--card-ui-portrait-ratio);
  align-self: start;
}

.marking-target-copy,
.card-workshop-library-copy {
  display: grid;
  align-content: start;
  align-items: start;
  gap: var(--card-ui-space-2);
  min-width: 0;
}

.card-workshop-preview {
  align-content: start;
}

.card-workshop-preview-image {
  width: 100%;
  aspect-ratio: var(--card-ui-portrait-ratio);
  align-self: start;
}

.card-workshop-library-card {
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: var(--card-ui-space-3);
}

.card-workshop-library-card > img {
  width: 72px;
  height: auto;
  aspect-ratio: var(--card-ui-portrait-ratio);
  align-self: start;
}

.card-workshop-preview-fields,
.card-workshop-library-fields {
  align-self: start;
  gap: var(--card-ui-meta-gap);
  margin: 0;
}

.card-workshop-library-copy > strong {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
  line-height: 1.2;
  overflow-wrap: normal;
  text-overflow: clip;
  text-wrap: pretty;
  white-space: normal;
  word-break: auto-phrase;
  -webkit-box-orient: initial;
  -webkit-line-clamp: unset;
}

.card-workshop-library-history,
.card-workshop-library-fields {
  width: 100%;
  min-width: 0;
}

.card-workshop-library-history > span,
.card-workshop-library-fields > span {
  flex: 0 0 auto;
  width: max-content;
  max-width: 100%;
  overflow: visible;
  overflow-wrap: normal;
  text-overflow: clip;
  white-space: nowrap;
  word-break: keep-all;
}

.card-workshop-history > .country-flag {
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  max-width: 42px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  padding: 0;
}

.card-workshop-library-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  align-content: stretch;
}

.card-workshop-library-actions > button {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.card-workshop-delete-button {
  min-width: 64px;
  min-height: 44px;
  align-self: stretch;
}

/* Map and miniature card surfaces keep the same crop and stable edges. */
.ante-map-boss-stop {
  align-items: start;
}

.ante-map-boss-card {
  aspect-ratio: var(--card-ui-portrait-ratio);
}

.ante-map-boss-copy {
  align-content: start;
  padding-top: var(--card-ui-space-1);
}

.legacy-memory-target {
  width: 28px;
  height: auto;
  aspect-ratio: var(--card-ui-portrait-ratio);
}

@media (max-height: 760px) {
  .person-card .card-body {
    min-height: 86px;
    padding: 8px;
  }

  .person-card .card-status {
    --person-card-meta-height: 24px;
  }

  .enemy-card {
    grid-template-columns: clamp(66px, 36%, 116px) minmax(0, 1fr);
    min-height: 104px;
  }

  .enemy-card-body {
    gap: var(--card-ui-space-1);
    padding: 6px;
  }

  .shop-grid .shop-card-status {
    --person-card-meta-height: 26px;
  }
}

@media (max-width: 980px) {
  .shop-grid .shop-card-layout {
    grid-template-columns: clamp(92px, 22vw, 136px) minmax(0, 1fr);
    align-items: start;
  }

  .shop-grid .shop-card-portrait {
    width: 100%;
    height: auto;
    aspect-ratio: var(--card-ui-portrait-ratio);
    align-self: start;
  }
}

@media (max-width: 620px) {
  .marking-target-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .marking-target-portrait {
    width: min(180px, 100%);
    justify-self: center;
  }
}

@media (min-width: 740px) and (max-width: 980px) and (max-height: 600px) {
  .android-native .app-shell {
    grid-template-columns: minmax(150px, 0.22fr) minmax(0, 0.78fr);
  }

  .android-native .left-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .android-native .table-panel {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .android-native .battle-status-row ~ .card-table {
    flex: 0 0 200px;
    min-height: 200px;
    height: 200px;
  }

  .android-native .action-bar {
    position: sticky;
    bottom: 0;
    background: var(--panel);
  }

  .android-native .collection-panel,
  .android-native .event-panel {
    min-height: 0;
    max-height: none;
  }

  .android-native .shop-person-items {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .android-native .shop-event-items {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Android system bars leave roughly 540 CSS pixels on short landscape phones.
   Let the hand consume the remaining space instead of forcing the action bar
   below the viewport. This block stays last so the older 760px card minimums
   cannot reintroduce the clipping. */
@media (min-width: 740px) and (max-height: 600px) {
  .android-native .app-shell {
    gap: 6px;
    padding: 6px;
  }

  .android-native .table-panel {
    gap: 6px;
    padding: 6px;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .android-native .enemy-panel {
    min-height: 150px;
    max-height: 150px;
  }

  .android-native .battle-status-row ~ .card-table {
    flex: 1 0 184px;
    min-height: 184px;
    height: auto;
    padding-top: 4px;
  }

  .android-native .person-card .card-body {
    grid-template-rows: minmax(26px, auto) auto;
    min-height: max-content;
    gap: 2px;
    padding: 4px;
  }

  .android-native .person-card {
    grid-template-rows: minmax(0, 1fr) auto;
    padding: 0;
  }

  .android-native .person-card .card-name {
    font-size: 0.58rem;
  }

  .android-native .person-card .card-status {
    --person-card-meta-height: 20px;
    --card-ui-meta-gap: 3px;
    min-height: 20px;
  }

  .android-native .person-card .card-meta-details {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 3px;
  }

  .android-native .person-card .card-fields {
    flex-wrap: wrap;
    gap: 2px;
  }

  .android-native .person-card .card-fields > .card-field {
    flex: 0 0 auto;
    width: max-content;
    min-width: 0;
    overflow: visible;
    padding: 2px 3px;
    font-size: 0.56rem;
    text-overflow: ellipsis;
  }

  .android-native .person-card .card-era {
    min-height: 20px;
    padding: 1px 3px;
    font-size: 0.52rem;
    white-space: nowrap;
  }

  .android-native .enemy-card {
    position: relative;
    grid-template-columns: minmax(0, 0.36fr) minmax(0, 0.64fr);
  }

  .android-native .enemy-card-body {
    gap: 3px;
    padding: 4px;
  }

  .android-native .enemy-card .enemy-card-name {
    font-size: 0.6rem;
  }

  .android-native .enemy-card .card-status {
    --person-card-meta-height: 16px;
    --card-ui-meta-gap: 3px;
    grid-template-columns: minmax(0, 1fr);
  }

  .android-native .enemy-card .card-status > .country-flag {
    position: absolute;
    bottom: 4px;
    left: 4px;
  }

  .android-native .enemy-card .card-fields > .card-field {
    height: auto;
    min-height: 16px;
    max-height: none;
    padding-inline: 3px;
    font-size: 0.52rem;
    white-space: normal;
  }

  .android-native .enemy-card .card-era {
    min-height: 16px;
    padding: 1px 3px;
    font-size: 0.5rem;
  }

  .android-native .enemy-summary strong {
    overflow: visible;
    line-height: 1.05;
  }

  .android-native .action-bar {
    position: sticky;
    bottom: 0;
    z-index: 45;
    flex-shrink: 0;
    padding-top: 0;
    background: var(--panel);
  }

  /* The Boss reward screen has four card rows (portrait, name, metadata, and
     ability). Compact its surrounding chrome and give every row explicit room
     so Android font scaling cannot collapse the text back over the portrait. */
  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-panel {
    gap: 6px;
    padding: 6px 10px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-header {
    align-items: center;
    gap: 8px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-header h2 {
    font-size: 0.9rem;
    line-height: 1.15;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-header p {
    margin-top: 2px;
    font-size: 0.68rem;
    line-height: 1.2;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .modal-header-actions,
  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-review-actions {
    flex-wrap: nowrap;
    gap: 5px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .modal-header-actions button {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 0.7rem;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 8px;
    padding: 4px 8px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss-portrait {
    width: 48px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-copy {
    gap: 1px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-next-boss .shop-upcoming-boss-description {
    display: none;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-grid {
    grid-auto-rows: minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    overflow: hidden;
    padding: 2px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-enhancement-reward {
    height: 100%;
    min-height: 0;
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 4px;
    padding: 6px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-portrait {
    width: min(100%, 108px);
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .legacy-choice-enhancement-reward > strong {
    min-height: calc(var(--card-ui-name-lines) * 1.2em);
    font-size: 0.72rem;
    line-height: 1.2;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .card-status {
    --person-card-meta-height: 20px;
    --card-ui-meta-gap: 3px;
    min-height: 20px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .card-meta-details {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: stretch;
    gap: 3px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .card-fields {
    flex-wrap: wrap;
    gap: 2px;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .card-fields > .card-field {
    flex: 0 0 auto;
    width: max-content;
    min-width: 0;
    overflow: visible;
    padding: 0 3px;
    font-size: 0.54rem;
    text-overflow: ellipsis;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .card-era {
    min-height: 20px;
    padding: 1px 3px;
    font-size: 0.52rem;
    white-space: nowrap;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-details {
    max-height: 100%;
    gap: 2px;
    margin-top: 0;
    overflow-y: auto;
    padding: 4px 6px;
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-name {
    font-size: 0.64rem;
    line-height: 1.2;
  }

  .android-native #legacyChoiceOverlay.boss-reward-choice .boss-reward-enhancement-description {
    font-size: 0.58rem;
    line-height: 1.25;
  }

  .android-native #shopOverlay {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .android-native #shopOverlay::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: var(--panel-2);
  }

  .android-native .shop-panel {
    display: flex;
    flex-direction: column;
    --shop-column-gap: 6px;
    --shop-row-gap: 5px;
    --shop-card-padding: 6px;
    height: auto;
    min-height: 100%;
    grid-template-rows: auto auto auto;
    align-content: start;
    overflow: visible;
    padding: 6px 10px;
  }

  .android-native .shop-panel .shop-header {
    gap: 8px;
    padding-bottom: 3px;
  }

  .android-native .shop-screen-label {
    font-size: 0.72rem;
  }

  .android-native .shop-panel .shop-heading-copy h2 {
    overflow: visible;
    font-size: 0.82rem;
    white-space: normal;
  }

  .android-native .shop-upcoming-boss {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 7px;
    padding: 3px 6px;
  }

  .android-native .shop-upcoming-boss-name {
    overflow: visible;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .android-native .shop-upcoming-boss-portrait {
    width: 36px;
  }

  .android-native .shop-upcoming-boss-description {
    display: none;
  }

  .android-native .shop-toolbar,
  .android-native .shop-panel .modal-actions {
    gap: 6px;
  }

  .android-native .shop-panel .shop-money,
  .android-native .shop-panel .modal-actions .secondary-button {
    min-height: 36px;
  }

  .android-native .shop-grid {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    height: auto;
    grid-template-rows: 150px auto;
  }

  .android-native .shop-people-section,
  .android-native .shop-secondary-row,
  .android-native .shop-services {
    flex: 0 0 auto;
  }

  .android-native .shop-person-items {
    height: 150px;
  }

  .android-native .shop-person-items,
  .android-native .shop-secondary-row,
  .android-native .shop-legacy-section > .shop-legacy-items,
  .android-native .shop-event-section > .shop-event-items {
    height: 100%;
  }

  .android-native .shop-grid .shop-card-item {
    height: 100%;
    min-height: 0;
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 4px;
  }

  .android-native .shop-grid .shop-card-portrait {
    width: 72px;
    height: auto;
    max-height: 110px;
    align-self: center;
  }

  .android-native .shop-grid .shop-card-layout {
    display: contents;
  }

  .android-native .shop-grid .shop-card-portrait {
    grid-column: 1;
    grid-row: 1 / 3;
  }

  .android-native .shop-grid .shop-card-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .android-native .shop-grid .shop-card-item > .shop-item-footer {
    grid-column: 2;
    grid-row: 2;
  }

  .android-native .shop-secondary-row,
  .android-native .shop-legacy-section > .shop-legacy-items,
  .android-native .shop-event-section > .shop-event-items {
    height: auto;
    overflow: visible;
  }

  .android-native .shop-legacy-section,
  .android-native .shop-event-section {
    height: auto;
    grid-template-rows: auto auto;
    align-content: start;
  }

  .android-native .shop-grid .shop-card-copy {
    align-self: start;
    gap: 3px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: thin;
    min-height: 0;
    max-height: 100%;
  }

  .android-native .shop-grid .shop-card-copy h3 {
    overflow: visible;
    font-size: 0.78rem;
    line-height: 1.2;
    text-wrap: balance;
    white-space: normal;
  }

  .android-native .shop-grid .shop-card-status {
    --person-card-meta-height: 22px;
    gap: 3px;
  }

  .android-native .shop-panel .shop-card-item .shop-item-footer .price-button,
  .android-native .shop-panel .shop-legacy-item .shop-item-footer .price-button,
  .android-native .shop-panel .shop-event-item .shop-item-footer .price-button {
    width: 84px;
    height: 34px;
    min-width: 84px;
    min-height: 34px;
    padding-inline: 9px;
    font-size: 0.78rem;
  }

  .android-native .shop-legacy-items > .shop-item,
  .android-native .shop-event-items > .shop-item,
  .android-native .shop-legacy-item,
  .android-native .shop-event-item {
    height: 100%;
    min-height: 0;
  }

  .android-native .shop-legacy-items > .shop-item,
  .android-native .shop-event-items > .shop-item,
  .android-native .shop-legacy-item,
  .android-native .shop-event-item {
    height: max-content;
    max-height: none;
    min-height: 180px;
    grid-template-rows: auto minmax(min-content, 1fr) auto;
  }

  .android-native .shop-legacy-title-row,
  .android-native .shop-secondary-row .shop-event-item > h3 {
    min-height: 2.2rem;
  }

  .android-native .shop-legacy-item .shop-legacy-icon {
    flex-basis: 2.2rem;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.7rem;
  }

  .android-native .shop-secondary-row .shop-legacy-item h3,
  .android-native .shop-secondary-row .shop-event-item h3 {
    font-size: 0.78rem;
    line-height: 1.2;
  }

  .android-native .shop-offer-description,
  .android-native .shop-legacy-description,
  .android-native .shop-event-description,
  .android-native .shop-legacy-item .legacy-description {
    font-size: 0.7rem;
    line-height: 1.3;
    display: block;
    min-height: 0;
    overflow: visible;
    -webkit-line-clamp: unset;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }

  .android-native .card-enhancement-side-tooltip.is-zone-viewer {
    overflow-y: auto;
    pointer-events: auto;
  }

  .android-native .shop-service-items .shop-service-item {
    min-height: 58px;
    padding: 5px 7px;
  }

  .android-native .shop-service-items .shop-service-item h3 {
    font-size: 0.78rem;
  }

  .android-native .shop-service-items .shop-service-item .price-button {
    min-width: 84px;
    min-height: 34px;
    padding-inline: 9px;
    font-size: 0.76rem;
  }
}
