/* Godbreaker v2 UI — companions, Norn's Well, Runestones, daily quests (Phase 1, UI agent).
   Rules followed (game-ui-craft): no boxed facts, one gold primary per surface, hairline zones, round = companion,
   forged display type only on titles (≥ 18 px full, lite below), tabular numerals, ≥ 44 px hit areas,
   everything decorative off under prefers-reduced-motion. Loaded after every other sheet. */

#game {
  --rs-blue: #8fd0ff;
  --v2-glass: linear-gradient(180deg, #121b19f2, #080d0cf7);
  --v2-hair: #c9a86a40;
}

/* ------------------------------------------------------------ runestone icon (painted, SVG stone fallback) */
#game .v2-rs { display: inline-grid; place-items: center; flex: none; width: 1.25em; height: 1.25em; vertical-align: -.25em; }
#game .v2-rs img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 1px #000a); }
#game .v2-rs.no-art { background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M10 3h12l6 10-3 16H7L4 13z' fill='%23435263' stroke='%23161d24' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M10 3h12l6 10H4z' fill='%23596b7d'/%3E%3Cpath d='M13 9v15M13 9l6 3.5-6 3.5 6.5 8' fill='none' stroke='%239fdcff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); filter: drop-shadow(0 0 3px #6cc8ff55) drop-shadow(0 1px 1px #000a); }
#game .v2-num { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ painted portrait with rune-colour fallback */
#game .v2-portrait { position: relative; display: block; overflow: hidden; aspect-ratio: 1;
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--rune, #c9a86a) 70%, white 10%), color-mix(in srgb, var(--rune, #c9a86a) 35%, #050807) 72%); }
#game .v2-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
#game .v2-portrait .v2-pglyph { position: absolute; inset: 0; display: grid; place-items: center; color: #fff6dc; opacity: .9; }
#game .v2-portrait .v2-pglyph .ui-icon { width: 46%; height: 46%; filter: drop-shadow(0 1px 2px #000c); }
#game .v2-portrait:not(.no-art) .v2-pglyph { visibility: hidden; }

#game .v2-stars { display: inline-flex; gap: 1px; font-size: 12px; line-height: 1; letter-spacing: 0; }
#game .v2-stars i { font-style: normal; color: #ffffff26; }
#game .v2-stars i.on { color: #f3c95c; text-shadow: 0 1px 1px #000c; }

/* ------------------------------------------------------------ map header: progress subtitle + one counter chip */
#game .map-header .realm .v2-progress { display: block; font: 500 12px/1.2 var(--ff-num), var(--ff-body); color: var(--tx-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }
#game .map-header .v2-chip { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
#game .map-header .v2-chip > i { width: 1px; height: 14px; margin: 0 3px; background: #ffffff24; }
#game .map-header .v2-chip .ui-art, #game .map-header .v2-chip img { width: 17px; height: 17px; }
#game .map-header .v2-chip .v2-rs { width: 18px; height: 18px; }
#game .map-header .v2-chip .v2-rs + .v2-num { color: #dbeffc; }

/* ------------------------------------------------------------ map footer: five equal journey actions */
#game .map-footer.v2-footer { justify-content: center; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
#game .map-footer.v2-footer .map-actions { flex: 1 1 auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; max-width: 460px; margin: 0 auto; }
#game .map-footer.v2-footer .map-actions .icon-btn.labeled { width: 100%; min-width: 0; height: 48px; padding: 5px 2px 4px; }
#game .map-footer.v2-footer .map-actions .icon-btn.labeled .ui-icon { width: 19px; height: 19px; }
#game .map-footer.v2-footer .map-actions .icon-btn.labeled small { font-size: 11px; letter-spacing: 0; max-width: 100%; overflow: visible; }
#game .map-footer.v2-footer .map-actions .icon-btn.labeled:active { transform: scale(.94); filter: brightness(.85); }

/* ------------------------------------------------------------ toast */
#game .v2-toast { position: absolute; z-index: 90; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 9px 16px; border-radius: 999px; background: #0b100fef; border: 1px solid var(--v2-hair);
  box-shadow: 0 8px 20px #000b; font: 600 13px/1.35 var(--ff-body); color: var(--tx-hi); text-align: center; text-wrap: balance;
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: center; animation: v2ToastIn .18s ease-out; }
#game .v2-toast.out { opacity: 0; transition: opacity .3s; }
#game .v2-toast .ui-art, #game .v2-toast img { width: 16px; height: 16px; }
@keyframes v2ToastIn { from { opacity: 0; transform: translate(-50%, 6px); } }

/* ------------------------------------------------------------ shared full-screen shell */
#game .v2-screen { position: absolute; inset: 0; z-index: 70; display: flex; flex-direction: column; overflow: hidden;
  background: radial-gradient(ellipse 120% 70% at 50% 30%, #18302e, #070b0b 70%); color: var(--tx); animation: v2In .2s ease-out; }
@keyframes v2In { from { opacity: 0; } }
#game .v2-head { position: relative; z-index: 2; flex: none; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; column-gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(8px, env(safe-area-inset-left));
  background: linear-gradient(#050807e6, #05080700); }
#game .v2-head h2 { margin: 0; font-size: max(22px, calc(var(--u) * 6)); line-height: 1.1; letter-spacing: .04em; white-space: nowrap; text-transform: none; }
#game .v2-back, #game .v2-sheet-close { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--tx-hi); cursor: pointer; }
#game .v2-back .ui-icon, #game .v2-sheet-close .ui-icon { width: 20px; height: 20px; }
#game .v2-back:active, #game .v2-sheet-close:active { transform: scale(.92); filter: brightness(.8); }
#game .v2-back:focus-visible, #game .v2-sheet-close:focus-visible { outline: none; box-shadow: 0 0 0 1px var(--accent); }
#game .v2-purse { display: inline-flex; align-items: center; gap: 5px; font: 700 15px/1 var(--ff-num), var(--ff-body); color: var(--tx-hi); white-space: nowrap;
  padding: 6px 10px; border-radius: 999px; background: #0008; }
#game .v2-purse .v2-rs { width: 20px; height: 20px; }
#game .v2-purse .ui-art, #game .v2-purse > img { width: 18px; height: 18px; }
#game .v2-purse .v2-dot { width: 1px; height: 14px; margin: 0 3px; background: #ffffff24; }
#game .v2-sec { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; font: 600 11px/1 var(--ff-body); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
#game .v2-sec::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, #c9a86a55, transparent); }
#game .v2-sec small { order: 2; font: 500 12px/1 var(--ff-num), var(--ff-body); letter-spacing: 0; text-transform: none; color: var(--tx-dim); }
#game .v2-sec::after { order: 1; }
#game .v2-note { margin: 0 0 8px; font: italic 400 14px/1.45 var(--ff-story, Georgia, serif); color: var(--tx-dim); text-wrap: pretty; }
#game .v2-eyebrow { margin: 0 0 8px; font: 600 11px/1.2 var(--ff-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
#game .v2-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18vh 24px 0; text-align: center; }
#game .v2-empty-rune { font: 400 40px/1 'Noto Sans Runic', serif; color: #e9d39b88; }
#game .v2-empty b { font: 700 18px/1.2 var(--ff-head); color: var(--tx-hi); }
#game .v2-empty p { margin: 0; font: italic 15px/1.4 var(--ff-story, Georgia, serif); color: var(--tx-dim); }
#game .v2-screen .text-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none; cursor: pointer;
  font: 600 14px/1 var(--ff-body); color: var(--accent); text-decoration: underline; text-decoration-color: #e3bf7855; text-underline-offset: 3px; }
#game .v2-screen .text-link:active { transform: scale(.94); filter: brightness(.85); }
#game .v2-screen .btn:active { transform: scale(.95); filter: brightness(.85); transition: transform 60ms; }
#game .v2-screen .btn[aria-disabled="true"] { opacity: .55; filter: saturate(.6); }
#game .v2-screen .btn .wp-c { display: inline-flex; align-items: center; gap: 3px; font: 700 13px/1 var(--ff-num), var(--ff-body); font-variant-numeric: tabular-nums; }
#game .v2-screen .btn .wp-c .v2-rs { width: 16px; height: 16px; }
#game .v2-screen .btn .wp-c .ui-art, #game .v2-screen .btn .wp-c img { width: 15px; height: 15px; }

/* bottom sheet (odds, history, companion detail) */
#game .v2-sheet { position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; background: #000a; animation: v2In .16s ease-out; }
#game .v2-sheet[hidden] { display: none; }
#game .v2-sheet-card { position: relative; width: 100%; max-height: 88%; display: flex; flex-direction: column; overflow: hidden;
  padding: 14px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  border-radius: 18px 18px 0 0; border-top: 1px solid #c9a86a66; background: var(--v2-glass); box-shadow: 0 -12px 30px #000c; animation: v2Up .22s cubic-bezier(.2, .7, .3, 1); }
@keyframes v2Up { from { transform: translateY(24px); opacity: .4; } }
#game .v2-sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; margin: -4px -8px 4px 0; }
#game .v2-sheet-head h3 { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: .04em; text-transform: none; }

/* ============================================================ Norn's Well */
#game .well-screen { background: linear-gradient(180deg, #050807b3 0%, #05080700 22%, #05080700 55%, #050807f2 86%), var(--well-bg, none) center / cover no-repeat, radial-gradient(ellipse 90% 60% at 50% 42%, #1d4746, #0a1414 62%, #050807); }
#game .well-tabs { flex: none; display: grid; grid-template-columns: 1fr 1fr; margin: 0 max(16px, env(safe-area-inset-left)); border-bottom: 1px solid #ffffff1a; }
#game .well-tab { position: relative; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 6px 8px;
  border: 0; background: none; cursor: pointer; color: var(--tx-dim); }
#game .well-tab span { font: 700 13px/1 var(--ff-head); letter-spacing: .08em; text-transform: uppercase; }
#game .well-tab small { font: 500 12px/1.1 var(--ff-body); color: var(--tx-faint); white-space: nowrap; }
#game .well-tab.on { color: var(--tx-hi); }
#game .well-tab.on small { color: var(--tx-dim); }
#game .well-tab.on::after { content: ''; position: absolute; left: 22%; right: 22%; bottom: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
#game .well-tab:focus-visible { outline: none; color: var(--accent-hi); }
#game .well-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 14px max(20px, env(safe-area-inset-left)) 8px; }
#game .well-feature, #game .well-standard { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: auto 0 0; }
#game .well-medal { width: min(46vw, 190px); border-radius: 50%; box-shadow: 0 0 0 2px var(--rc), 0 0 0 6px #0009, 0 0 34px color-mix(in srgb, var(--rc) 45%, transparent), 0 12px 30px #000c; margin-bottom: 8px; }
#game .well-rarity { font: 600 11px/1.2 var(--ff-body); letter-spacing: .16em; text-transform: uppercase; color: var(--rc, var(--accent)); }
#game .well-name { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: .03em; text-transform: none; }
#game .well-desc { margin: 2px 0 0; max-width: 300px; font: italic 400 14.5px/1.45 var(--ff-story, Georgia, serif); color: var(--tx); text-wrap: balance; }
#game .well-ring { position: relative; width: min(56vw, 220px); aspect-ratio: 1; margin-bottom: 10px; }
#game .well-mini { position: absolute; left: 50%; top: 50%; width: 27%; transform: translate(-50%, -50%) rotate(calc(var(--i) * 360deg / var(--n))) translateY(-150%) rotate(calc(var(--i) * -360deg / var(--n))); }
#game .well-mini .v2-portrait { border-radius: 50%; box-shadow: 0 0 0 1.5px var(--rc), 0 4px 10px #000b; }
#game .well-rates { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; margin: 14px 0 0; font: 600 12px/1.2 var(--ff-num), var(--ff-body); color: var(--tx-dim); }
#game .well-rates span { display: inline-flex; align-items: center; gap: 5px; }
#game .well-rates i { width: 7px; height: 7px; transform: rotate(45deg); background: var(--rc); box-shadow: 0 0 6px var(--rc); }
#game .well-pity { margin: 8px 0 0; font: 500 13px/1.4 var(--ff-body); color: var(--tx-dim); text-wrap: balance; }
#game .well-pity b { font-family: var(--ff-num); font-variant-numeric: tabular-nums; color: var(--tx-hi); }
#game .well-links { display: flex; gap: 18px; justify-content: center; margin: 0 0 auto; }
#game .well-actions { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 10px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
#game .well-actions .well-pull { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 6px 8px; margin: 0; }
#game .well-actions .wp-l { font: 700 14px/1 var(--ff-head); letter-spacing: .06em; }

/* odds + history */
#game .odds-scroll, #game .hist-list { min-height: 0; overflow-y: auto; }
#game .odds-table { width: 100%; border-collapse: collapse; font: 500 13px/1.3 var(--ff-body); color: var(--tx); }
#game .odds-table th, #game .odds-table td { padding: 8px 4px; border-bottom: 1px solid #ffffff10; text-align: right; font-variant-numeric: tabular-nums; }
#game .odds-table td { font-family: var(--ff-num), var(--ff-body); }
#game .odds-table thead th:first-child { text-align: left; }
#game .odds-table thead th { font: 600 11px/1.2 var(--ff-body); letter-spacing: .06em; text-transform: uppercase; color: var(--tx-faint); vertical-align: bottom; }
#game .odds-table tbody th { text-align: left; font-weight: 600; color: var(--tx-hi); white-space: nowrap; }
#game .odds-table tbody th i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; transform: rotate(45deg); background: var(--rc); vertical-align: 1px; }
#game .odds-table tbody th em { font: italic 12px var(--ff-story, Georgia, serif); color: var(--accent); }
#game .odds-table tbody + tbody tr:first-child th, #game .odds-table tbody + tbody tr:first-child td { padding-top: 14px; }
#game .odds-table tr.tier th, #game .odds-table tr.tier td { color: var(--tx-hi); font-weight: 700; }
#game .odds-notes { margin-top: 12px; }
#game .odds-notes p { margin: 0 0 7px; font: 400 13px/1.45 var(--ff-body); color: var(--tx-dim); text-wrap: pretty; }
#game .odds-notes .odds-you { color: var(--tx); }
#game .hist-list { list-style: none; margin: 0; padding: 0; }
#game .hist-list li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 8px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid #ffffff10; }
#game .hist-list li > i { grid-row: 1 / 3; align-self: center; width: 7px; height: 7px; transform: rotate(45deg); background: var(--rc); }
#game .hist-list b { font: 700 14px/1.2 var(--ff-head); color: var(--tx-hi); }
#game .hist-list .h-r { font: 600 11px/1 var(--ff-body); letter-spacing: .1em; text-transform: uppercase; color: var(--rc); }
#game .hist-list small { grid-column: 2 / 4; font: 400 12px/1.3 var(--ff-num), var(--ff-body); color: var(--tx-faint); }

/* pull reveal (fallback; G.EffectsWell.reveal replaces the animation when present) */
#game .well-reveal { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: 24px max(14px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom)); background: radial-gradient(ellipse 80% 55% at 50% 45%, #10302e, #040707); animation: v2In .2s ease-out; }
#game .well-reveal[hidden] { display: none; }
#game .well-reveal[data-best="legendary"] { background: radial-gradient(ellipse 80% 55% at 50% 45%, #3a2c0c, #040707); }
#game .well-reveal[data-best="epic"] { background: radial-gradient(ellipse 80% 55% at 50% 45%, #2a1840, #040707); }
#game .wr-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px 8px; width: 100%; max-width: 440px; perspective: 900px; }
#game .wr-grid.one { grid-template-columns: minmax(0, 168px); justify-content: center; }
#game .wr-card { position: relative; aspect-ratio: 2 / 3; }
#game .wr-inner { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateY(0deg); }
#game .wr-back, #game .wr-face { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
#game .wr-back { display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #24403c, #0a1211 75%); box-shadow: inset 0 0 0 1px #c9a86a55, 0 6px 14px #000b; }
#game .wr-back span { font: 400 28px/1 'Noto Sans Runic', serif; color: #e9d39b99; }
#game .wr-face { transform: rotateY(180deg); background: #0a1110; box-shadow: inset 0 0 0 1px var(--rc), 0 0 18px color-mix(in srgb, var(--rc) 40%, transparent), 0 6px 14px #000b; }
#game .wr-face .wr-art { position: absolute; left: 0; right: 0; top: 0; width: 100%; }
#game .wr-face::after { content: ''; position: absolute; inset: 0; background: linear-gradient(transparent 42%, #050807 78%); pointer-events: none; }
#game .wr-frame { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#game .wr-frame img { width: 100%; height: 100%; object-fit: fill; }
#game .wr-name { position: absolute; z-index: 3; left: 3px; right: 3px; bottom: 19px; font: 700 11px/1.1 var(--ff-head); color: var(--tx-hi); text-align: center; text-shadow: 0 1px 2px #000; overflow-wrap: anywhere; }
#game .wr-sub { position: absolute; z-index: 3; left: 2px; right: 2px; bottom: 6px; font: 600 11px/1 var(--ff-num), var(--ff-body); color: var(--rc); text-align: center; white-space: nowrap; }
#game .wr-new { position: absolute; z-index: 4; top: 4px; left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 999px;
  font: 800 11px/1 var(--ff-body); letter-spacing: .08em; color: #1b1205; background: linear-gradient(#ffe7a1, #e2b04c); box-shadow: 0 1px 3px #000a; }
#game .wr-grid.one .wr-name { font-size: 16px; bottom: 30px; }
#game .wr-grid.one .wr-sub { font-size: 13px; bottom: 11px; }
#game .wr-grid.one .wr-new { font-size: 12px; top: 8px; }
#game .well-reveal.running .wr-inner { animation: wrFlip .5s cubic-bezier(.3, .7, .3, 1) both; animation-delay: calc(.45s + var(--i) * .14s); }
#game .well-reveal.running .wr-card { animation: wrDeal .3s ease-out both; animation-delay: calc(var(--i) * .03s); }
#game .well-reveal.done .wr-inner, #game .well-reveal.skip .wr-inner { animation: none; transform: rotateY(180deg); }
#game .well-reveal.running.skip .wr-card { animation: none; }
@keyframes wrFlip { 0% { transform: rotateY(0); } 45% { transform: rotateY(100deg) scale(1.06); } 100% { transform: rotateY(180deg); } }
@keyframes wrDeal { from { opacity: 0; transform: translateY(10px) scale(.94); } }
#game .well-reveal.running .r-legendary .wr-face, #game .well-reveal.running .r-epic .wr-face { animation: wrShine 1s ease-out both; animation-delay: calc(.6s + var(--i) * .14s); }
@keyframes wrShine { 0% { box-shadow: inset 0 0 0 1px var(--rc), 0 0 0 0 transparent; } 30% { box-shadow: inset 0 0 0 1px var(--rc), 0 0 30px 6px var(--rc); } 100% { box-shadow: inset 0 0 0 1px var(--rc), 0 0 18px color-mix(in srgb, var(--rc) 40%, transparent); } }
#game .wr-skip { margin: 0; font: 500 12px/1 var(--ff-body); color: var(--tx-faint); }
#game .well-reveal.done .wr-skip, #game .well-reveal.skip .wr-skip { visibility: hidden; }
#game .wr-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; max-width: 360px; opacity: 0; pointer-events: none; transition: opacity .2s; }
#game .well-reveal.done .wr-actions, #game .well-reveal.skip .wr-actions { opacity: 1; pointer-events: auto; }
#game .wr-actions .btn { margin: 0; min-height: 48px; }

/* ============================================================ Companion Book */
#game .book-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px max(16px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
#game .book-lead { margin: 2px 0 0; font: italic 400 15px/1.4 var(--ff-story, Georgia, serif); color: var(--tx-dim); }
#game .book-lead b { font: 700 15px var(--ff-head); font-style: normal; color: var(--tx-hi); }
#game .book-body .v2-note { display: flex; align-items: center; flex-wrap: wrap; margin: -6px 0 4px; }
#game .bk-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 10px; }
#game .bk-card { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 0 0 4px; border: 0; background: none; cursor: pointer; color: inherit; text-align: center; }
#game .bk-art { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 75%, transparent), 0 0 14px color-mix(in srgb, var(--rc) 22%, transparent), 0 6px 12px #000a; }
#game .bk-art .v2-portrait { position: absolute; inset: 0; }
#game .bk-art .wr-frame { inset: 0; }
#game .bk-art::after { content: ''; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rc) 75%, transparent); pointer-events: none; }
#game .bk-name { max-width: 100%; font: 700 13px/1.15 var(--ff-head); color: var(--tx-hi); overflow-wrap: anywhere; }
#game .bk-meta { display: inline-flex; align-items: center; gap: 6px; }
#game .bk-meta .v2-stars { font-size: 11px; }
#game .bk-lv { font: 600 11px/1 var(--ff-num), var(--ff-body); color: var(--tx-dim); }
#game .bk-soon { font: italic 400 12px/1.2 var(--ff-story, Georgia, serif); color: var(--tx-faint); }
#game .bk-active { position: absolute; z-index: 3; right: 5px; top: 5px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 40% 30%, #ffe7a1, #c9963c); color: #1b1205; box-shadow: 0 1px 3px #000c; }
#game .bk-active .ui-icon { width: 13px; height: 13px; stroke-width: 2.4; }
#game .bk-card.active .bk-art { box-shadow: inset 0 0 0 2px var(--accent), 0 0 16px #e3bf7855, 0 6px 12px #000a; }
#game .bk-card.missing .v2-portrait { filter: brightness(0) contrast(1); opacity: .55; }
#game .bk-card.missing .bk-art { box-shadow: inset 0 0 0 1px #ffffff1c; background: radial-gradient(circle at 50% 40%, #1a2523, #070b0a); }
#game .bk-card.missing .bk-name { color: var(--tx-faint); }
#game .bk-card.missing .wr-frame { opacity: .25; }
#game .bk-card:active { transform: scale(.95); }
#game .bk-card:focus-visible { outline: none; }
#game .bk-card:focus-visible .bk-art { box-shadow: inset 0 0 0 2px var(--accent-hi); }

/* detail sheet: type hierarchy, no boxes */
#game .bd { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; min-height: 0; overflow-y: auto; padding-top: 4px; }
#game .bd > .v2-sheet-close { position: absolute; right: -8px; top: -6px; }
#game .bd-medal { width: 112px; border-radius: 50%; box-shadow: 0 0 0 2px var(--rc), 0 0 0 5px #0009, 0 0 26px color-mix(in srgb, var(--rc) 40%, transparent); margin: 4px 0 10px; }
#game .bd.missing .bd-medal { filter: grayscale(.85) brightness(.55); }
#game .bd-rarity { font: 600 11px/1.3 var(--ff-body); letter-spacing: .14em; text-transform: uppercase; color: var(--rc); }
#game .bd-name { margin: 4px 0 4px; font-size: 22px; line-height: 1.1; letter-spacing: .03em; text-transform: none; }
#game .bd > .v2-stars { font-size: 15px; gap: 2px; margin-bottom: 2px; }
#game .bd-grow { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 360px; margin: 12px 0 2px; }
#game .bd-stat { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 4px; padding: 2px 8px; }
#game .bd-stat + .bd-stat { border-left: 1px solid #ffffff1a; }
#game .bd-stat small { flex-basis: 100%; font: 600 11px/1.4 var(--ff-body); letter-spacing: .12em; text-transform: uppercase; color: var(--tx-faint); }
#game .bd-stat b { font: 700 22px/1.1 var(--ff-num), var(--ff-body); color: var(--tx-hi); }
#game .bd-stat span { font: 500 13px/1 var(--ff-num), var(--ff-body); color: var(--tx-dim); }
#game .bd-bar { flex-basis: 70%; height: 3px; margin-top: 6px; border-radius: 2px; background: #ffffff17; overflow: hidden; }
#game .bd-bar i { display: block; width: var(--p); height: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--rc) 70%, white 10%), var(--rc)); }
#game .bd-skill { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 12px 4px 0; margin-top: 12px; border-top: 1px solid #ffffff12; }
#game .bd-label { font: 600 11px/1.2 var(--ff-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
#game .bd-skill b { font: 700 16px/1.2 var(--ff-head); color: var(--tx-hi); }
#game .bd-skill p { margin: 0; font: 400 14px/1.45 var(--ff-body); color: var(--tx); text-wrap: pretty; }
#game .bd-soon { font: italic 400 13px/1.3 var(--ff-story, Georgia, serif); color: var(--accent); }
#game .bd-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; width: 100%; margin-top: 16px; }
#game .bd-actions .btn { flex: 1 1 140px; max-width: 220px; min-height: 48px; margin: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
#game .bd-in, #game .bd-max { flex: 1 1 140px; max-width: 220px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; font: 600 13px/1 var(--ff-body); color: var(--ok); }
#game .bd-max { color: var(--tx-faint); }
#game .bd-in .ui-icon { width: 16px; height: 16px; }

/* ============================================================ Quest journal: Daily section + login calendar */
#game .quest-panel { max-height: calc(100dvh - 24px); overflow-y: auto; }
#game .quest-panel .v2-sec { margin: 14px 0 10px; }
#game .quest-panel .oath-sec { margin-top: 18px; }
#game .quest-panel .oath-sec + .sub { margin-top: 0; }
#game .login-row { list-style: none; margin: 0 0 6px; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; position: relative; }
#game .login-row::before { content: ''; position: absolute; left: 7%; right: 7%; top: 17px; height: 1px; background: #c9a86a40; }
#game .ld { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 52px; }
#game .ld-disc { position: relative; z-index: 1; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid #c9a86a66; background: radial-gradient(circle at 50% 35%, #1f2a27, #0b1110); box-shadow: 0 0 0 3px #0d1513; color: var(--tx-dim); }
#game .ld-disc b { font: 700 13px/1 var(--ff-head); }
#game .ld-amt { display: inline-flex; align-items: center; gap: 2px; font: 600 11px/1 var(--ff-num), var(--ff-body); color: var(--tx-dim); font-variant-numeric: tabular-nums; }
#game .ld.big .ld-disc { width: 38px; height: 38px; margin-top: -2px; border-color: #8fd0ff88; }
#game .ld.big .ld-rs { width: 24px; height: 24px; }
#game .ld.claimed .ld-disc { border-color: #e3bf78; background: radial-gradient(circle at 40% 30%, #f6dd9c, #b98a3a); color: #1b1205; }
#game .ld.claimed .ld-disc .ui-icon { width: 16px; height: 16px; stroke-width: 2.6; }
#game .ld.claimed .ld-amt { color: var(--tx-faint); }
#game .ld.today { cursor: pointer; }
#game .ld.today .ld-disc { border-color: var(--accent-hi); color: var(--tx-hi); box-shadow: 0 0 0 3px #0d1513, 0 0 0 4px #e3bf78aa, 0 0 14px #e3bf7888; animation: ldBreath 2.4s ease-in-out infinite; }
#game .ld.today .ld-amt { color: var(--tx-hi); }
#game .ld.today::after { content: 'Tap'; position: absolute; top: -13px; font: 700 11px/1 var(--ff-body); letter-spacing: .06em; color: var(--accent-hi); text-transform: uppercase; }
#game .ld.today:active .ld-disc { transform: scale(.92); }
#game .ld.today:focus-visible { outline: none; }
#game .ld.today:focus-visible .ld-disc { box-shadow: 0 0 0 3px #0d1513, 0 0 0 5px var(--accent-hi); }
@keyframes ldBreath { 50% { box-shadow: 0 0 0 3px #0d1513, 0 0 0 4px #e3bf78, 0 0 20px #e3bf78bb; } }
#game .login-row + .dq-list { margin-top: 4px; }
#game .dq-list { list-style: none; margin: 0; padding: 0; }
#game .dq { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 10px 0; border-top: 1px solid #ffffff0d; }
#game .dq-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
#game .dq-desc { font: 500 14px/1.3 var(--ff-body); color: var(--tx-hi); text-wrap: pretty; }
#game .dq-line { display: flex; align-items: center; gap: 8px; }
#game .dq-bar { flex: 1 1 auto; max-width: 150px; height: 3px; border-radius: 2px; background: #ffffff17; overflow: hidden; }
#game .dq-bar i { display: block; width: var(--p); height: 100%; background: linear-gradient(90deg, #c9a86a, #f0d08a); }
#game .dq-num { font: 600 12px/1 var(--ff-num), var(--ff-body); color: var(--tx-dim); font-variant-numeric: tabular-nums; }
#game .dq-end { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
#game .dq-reward { display: inline-flex; align-items: center; gap: 3px; font: 600 12px/1 var(--ff-num), var(--ff-body); color: var(--tx); white-space: nowrap; }
#game .dq-reward > i { width: 1px; height: 11px; margin: 0 4px; background: #ffffff24; }
#game .dq-reward .v2-rs { width: 16px; height: 16px; }
#game .dq-reward .ui-art, #game .dq-reward > img { width: 15px; height: 15px; }
#game .dq-end .btn { margin: 0; min-height: 36px; min-width: 76px; }
#game .dq-done { display: inline-flex; align-items: center; gap: 4px; font: 600 12px/1 var(--ff-body); color: var(--ok); }
#game .dq-done .ui-icon { width: 13px; height: 13px; }
#game .dq-claimed .dq-desc, #game .dq-claimed .dq-reward { color: var(--tx-faint); }
#game .dq-ready .dq-bar i { background: linear-gradient(90deg, #9fd48a, #c9f0b0); }

/* ============================================================ result: runestone tile */
#game .reward-tile.runestone .rt-ic .v2-rs { width: 100%; height: 100%; }
#game .reward-tile.runestone b { color: #dbeffc; }

/* ============================================================ battle: companion badge left of the hero band
   Row = [badge][8 px][hero band] at exactly --board-w. The band keeps its light frame; the badge is a round painted
   medallion in the skill-socket family with a 2 px charge ring (closest-side mask) in the rarity colour. */
#game .b-player.has-companion { --cb-size: 42px; --cb-slot: calc(var(--cb-size) + 10px);
  width: calc(var(--board-w, calc(100% - var(--u) * 3)) - var(--cb-slot)); max-width: calc(100% - 12px - var(--cb-slot)); margin-left: var(--cb-slot); overflow: visible; }
#game .companion-badge { --ring: #c9a86a; --track: #ffffff1c; position: absolute; z-index: 4; left: calc(-1 * var(--cb-slot)); top: 50%; width: 44px; height: 44px; margin-left: -1px;
  transform: translateY(-50%); display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
#game .companion-badge .cb-disc { position: relative; width: var(--cb-size); height: var(--cb-size); border-radius: 50%; }
#game .companion-badge .cb-disc::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(var(--ring) calc(var(--charge, 0) * 1%), var(--track) 0);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); mask: radial-gradient(closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); }
#game .companion-badge .cb-disc::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; opacity: 0;
  background: conic-gradient(from 0deg, transparent 0 70%, color-mix(in srgb, var(--ring) 60%, white) 88%, transparent 100%);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(closest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); }
#game .companion-badge .cb-art { width: 100%; height: 100%; border-radius: 50%; box-shadow: inset 0 0 0 1px #00000080, 0 2px 5px #000b; }
#game .companion-badge .cb-art img { filter: saturate(.75) brightness(.92); transition: filter .25s; }
#game .companion-badge .cb-name { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); z-index: 2; padding: 1px 5px 2px; border-radius: 999px; white-space: nowrap;
  font: 700 11px/1 var(--ff-body); letter-spacing: .02em; color: #e9dfc6; background: #0b100fe6; border: 1px solid #ffffff1f; pointer-events: none; }
#game .companion-badge.full .cb-disc::before, #game .companion-badge.ready .cb-disc::before { filter: drop-shadow(0 0 2px var(--ring)); }
#game .companion-badge.ready .cb-art img { filter: none; }
#game .companion-badge.ready .cb-disc { animation: cbBreath 2.8s ease-in-out infinite .9s; }
#game .companion-badge.ready .cb-name { color: #fff3d2; border-color: color-mix(in srgb, var(--ring) 60%, transparent); }
#game .companion-badge.just-ready .cb-disc::after { animation: chargedSweep .9s cubic-bezier(.3, .6, .3, 1); }
#game .companion-badge.just-ready .cb-disc { animation: cbFlash .9s ease-out; }
#game .companion-badge.dormant .cb-art img { filter: saturate(.55) brightness(.8); }
#game .companion-badge.casting .cb-disc { animation: cbCast .6s ease-out; }
#game .companion-badge.nudge .cb-disc { animation: cbNudge .3s ease-out; }
#game .companion-badge:active .cb-disc { transform: scale(.94); }
#game .companion-badge:focus-visible { outline: none; }
#game .companion-badge:focus-visible .cb-disc { box-shadow: 0 0 0 2px var(--accent-hi); }
@keyframes cbBreath { 50% { box-shadow: 0 0 12px 1px color-mix(in srgb, var(--ring) 45%, transparent); } }
@keyframes cbFlash { 0% { box-shadow: 0 0 0 1px #fff, 0 0 18px 6px color-mix(in srgb, var(--ring) 80%, white); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes cbCast { 0% { transform: scale(1); } 25% { transform: scale(1.14); box-shadow: 0 0 22px 6px color-mix(in srgb, var(--ring) 70%, white); } 100% { transform: scale(1); box-shadow: none; } }
@keyframes cbNudge { 30% { transform: translateX(-2px); } 60% { transform: translateX(2px); } }
@keyframes chargedSweep { 0% { opacity: 1; transform: rotate(-90deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: rotate(270deg); } }

/* ------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  #game .v2-screen, #game .v2-sheet, #game .v2-sheet-card, #game .v2-toast, #game .well-reveal { animation: none; }
  #game .well-reveal .wr-inner, #game .well-reveal .wr-card, #game .well-reveal .wr-face { animation: none !important; }
  #game .well-reveal .wr-inner { transform: rotateY(180deg); }
  #game .ld.today .ld-disc { animation: none; }
  #game .companion-badge .cb-disc, #game .companion-badge .cb-disc::after { animation: none !important; }
  #game .companion-badge.ready .cb-disc { box-shadow: 0 0 0 1px var(--ring); }
}

/* the VFX reveal (G.EffectsWell) paints its own overlay inside the host */
#game .well-reveal.vfx { padding: 0; background: none; animation: none; }

/* ---- review pass 1 (375 px screenshots) */
/* footer: "Companions" is the longest label; give its column a little more room instead of shrinking type */
#game .map-footer.v2-footer .map-actions { grid-template-columns: 1fr 1fr 1fr 1.22fr 1fr; }
/* toast sits high, never over a panel's buttons */
#game .v2-toast { top: calc(env(safe-area-inset-top) + 76px); bottom: auto; }
@keyframes v2ToastIn { from { opacity: 0; transform: translate(-50%, -6px); } }
/* book header: title keeps its room (coins only — feeding is what costs) */
#game .book-screen .v2-head h2 { font-size: 22px; }
#game .bk-soon-ic { position: absolute; z-index: 3; left: 5px; bottom: 5px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
  background: #0b100fd9; border: 1px solid #ffffff2a; color: var(--tx-dim); }
#game .bk-soon-ic .ui-icon { width: 13px; height: 13px; }
#game .book-legend { display: flex; align-items: center; gap: 6px; margin: -2px 0 10px; font: italic 400 13px/1.3 var(--ff-story, Georgia, serif); color: var(--tx-faint); }
#game .book-legend .ui-icon { width: 14px; height: 14px; color: var(--tx-dim); }
#game .bk-card.missing .v2-portrait { filter: grayscale(1) brightness(.32) contrast(1.1); opacity: 1; }
#game .bk-card.missing .bk-art { box-shadow: inset 0 0 0 1px #ffffff1c; background: none; }
#game .bd-actions .btn.wide { max-width: 300px; flex-basis: 260px; }
/* login calendar: today's disc carries its reward, "Claim" under it (no floating label colliding with the heading) */
#game .ld.today::after { content: none; }
#game .ld.today .ld-disc b { font: 700 12px/1 var(--ff-num), var(--ff-body); color: var(--accent-hi); }
#game .ld.today .ld-amt { font: 700 11px/1 var(--ff-body); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-hi); }
/* result: three or more reward tiles stack icon / number / label so long labels ("Runestones", "Experience") fit */
#game .reward-tiles:has(> :nth-child(3)) .reward-tile { grid-template-columns: 1fr; grid-template-rows: auto auto auto; justify-items: center; row-gap: 3px; padding: 8px 4px; text-align: center; }
#game .reward-tiles:has(> :nth-child(3)) .reward-tile .rt-ic { grid-row: auto; width: 30px; height: 30px; }
#game .reward-tiles:has(> :nth-child(3)) .reward-tile small { letter-spacing: .06em; }
/* odds: tier rows group the companions, so no rarity column */
#game .odds-table th:first-child { width: 52%; }
#game .odds-scroll { flex: 1 1 auto; padding-bottom: 6px; }
#game .well-share { margin: 6px 0 0; font: 600 12px/1.3 var(--ff-body); letter-spacing: .04em; color: var(--accent); }
#game .float.dmg.bite { font-size: 15px; opacity: .92; }   /* per-bite numbers (Fenrir), the flush total follows */

/* Lead fix 2026-10-12: the info block below the featured portrait sits over the glowing well; "Epic 17%" (violet on the
   lit stones) was unreadable. A soft dark scrim behind the text column + brighter rate labels, no box edge. */
#game .well-body { position: relative; }
#game .well-body > * { position: relative; z-index: 1; }
#game .well-body::before { content: ''; position: absolute; left: 50%; top: 46%; width: 118%; height: 62%; transform: translateX(-50%); z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 50% 50% at 50% 50%, #050a0bd9 0%, #050a0b99 55%, transparent 100%); }
#game .well-rates { color: #e9e2cf; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
#game .well-rates span { color: color-mix(in srgb, var(--rc) 55%, #fff); }
#game .well-pity, #game .well-share, #game .well-links { text-shadow: 0 1px 3px #000, 0 0 2px #000; }

/* ---- Companion Book as trading cards (2:3). Window/nameplate insets measured from card_frame_*.webp. */
#game .bk-card.tc { display: block; padding: 0; }
#game .bk-card.tc.r-rare { --wt: 10.2%; --ws: 12.1%; --wb: 23.7%; --np: 23.7%; }
#game .bk-card.tc.r-epic { --wt: 13.5%; --ws: 15.4%; --wb: 11.7%; --np: 11.5%; }
#game .bk-card.tc.r-legendary { --wt: 11.7%; --ws: 17.8%; --wb: 17%; --np: 16.6%; }
#game .tc-card { position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; filter: drop-shadow(0 6px 8px #000b); }
#game .tc-win { position: absolute; top: var(--wt); bottom: var(--wb); left: var(--ws); right: var(--ws); overflow: hidden; background: #0b1110; }
#game .tc-win .v2-portrait { position: absolute; inset: 0; width: 100%; height: 100%; }
#game .tc-win .v2-portrait img, #game .tc-win img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 35%; border-radius: 0; }
#game .tc-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#game .tc-plate { position: absolute; left: 14%; right: 14%; bottom: 0; height: var(--np); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
#game .bk-card.tc.r-epic .tc-plate, #game .bk-card.tc.r-legendary .tc-plate { height: calc(var(--np) + 2%); }
#game .tc-name { max-width: 100%; font: 700 10.5px/1.1 var(--ff-head); letter-spacing: .04em; color: #f4ead2; text-shadow: 0 1px 2px #000, 0 0 4px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#game .tc-plate .v2-stars { font-size: 10px; line-height: 1; letter-spacing: 0; text-shadow: 0 1px 1px #000; }
#game .tc-rune { position: absolute; z-index: 2; top: calc(var(--wt) + 3%); left: calc(var(--ws) + 3%); width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%;
  background: #070c0bcc; box-shadow: 0 0 0 1px color-mix(in srgb, var(--rc) 70%, transparent); color: var(--rc); }
#game .tc-rune .ui-icon { width: 11px; height: 11px; }
#game .tc-lv { position: absolute; z-index: 2; top: calc(var(--wt) + 3%); right: calc(var(--ws) + 3%); padding: 2px 5px; border-radius: 99px; background: #070c0bd9;
  font: 700 9.5px/1 var(--ff-num), var(--ff-body); font-variant-numeric: tabular-nums; color: #f1e3bd; }
#game .bk-card.tc .bk-active { top: auto; bottom: calc(var(--wb) + 3%); right: calc(var(--ws) + 3%); }
#game .bk-card.tc .bk-soon-ic { bottom: calc(var(--wb) + 3%); left: calc(var(--ws) + 3%); }
#game .bk-card.tc.active .tc-card { filter: drop-shadow(0 0 8px #f0c95ccc) drop-shadow(0 6px 8px #000b); }
#game .bk-card.tc.missing .tc-win .v2-portrait { filter: grayscale(1) brightness(.3) contrast(1.1); }
#game .bk-card.tc.missing .tc-frame { filter: grayscale(.85) brightness(.55); }
#game .bk-card.tc.missing .tc-rune { opacity: .45; }
#game .bk-card.tc.missing .tc-name { color: #8d8a80; }
#game .bk-card.tc:active .tc-card { transform: scale(.96); }

/* ---- TCG card (2026-10-12, owner refs: Hearthstone-style). G.V2UI.tcgCard; art assets/art/v8/tcg_front_*.webp.
   Every inset below is an alpha/colour scan of the painted front (work/v8/tcg_layout.json, % of card W / H).
   Text scales with the card via container query units (cqw); < 150 px wide shows short name + ability name only. */
.tcg { position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; container-type: inline-size; color: #f4ead2; text-align: center;
  filter: drop-shadow(0 5px 7px #000b); }
.tcg.r-rare { --wx: 17.19%; --wy: 9.24%; --ww: 65.63%; --wh: 47.27%; --ny: 54.43%; --nh: 7.68%; --nx: 19%;
  --px: 11.91%; --py: 67.84%; --pw: 74.22%; --ph: 23.7%; --gx: 11.82%; --gy: 7.81%; --gd: 17%; --bl: 11.52%; --br: 88.28%; --by: 91.93%; --bd: 18.55%; --rib: #0c1d3a; }
.tcg.r-epic { --wx: 22.85%; --wy: 13.02%; --ww: 54.1%; --wh: 41.41%; --ny: 53.91%; --nh: 6.64%; --nx: 22%;
  --px: 12.5%; --py: 66.54%; --pw: 74.8%; --ph: 23.31%; --gx: 13.57%; --gy: 10.09%; --gd: 19.2%; --bl: 11.62%; --br: 87.6%; --by: 91.28%; --bd: 19.9%; --rib: #26103d; }
.tcg.r-legendary { --wx: 24.02%; --wy: 12.37%; --ww: 51.95%; --wh: 38.67%; --ny: 50.65%; --nh: 5.08%; --nx: 21%;
  --px: 14.84%; --py: 65.36%; --pw: 70.31%; --ph: 25.78%; --gx: 17.29%; --gy: 11.85%; --gd: 15%; --bl: 12.99%; --br: 86.72%; --by: 92.25%; --bd: 17.2%; --rib: #3d0c10; }
.tcg.r-epic { filter: drop-shadow(0 0 5px color-mix(in srgb, var(--rc) 45%, transparent)) drop-shadow(0 5px 7px #000b); }
.tcg.r-legendary { filter: drop-shadow(0 0 7px color-mix(in srgb, var(--rc) 55%, transparent)) drop-shadow(0 5px 7px #000b); }
.tcg.active { filter: drop-shadow(0 0 3px #ffe39a) drop-shadow(0 0 10px #f0c95ccc) drop-shadow(0 5px 7px #000b); }
.tcg-in { position: absolute; inset: 0; }
/* portrait sits behind the frame; 1 % bleed under the carved rim so no seam shows */
.tcg-win { position: absolute; left: calc(var(--wx) - 1%); top: calc(var(--wy) - 1%); width: calc(var(--ww) + 2%); height: calc(var(--wh) + 1%); overflow: hidden;
  border-radius: 50% 50% 0 0 / 34% 34% 0 0; background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--rune) 55%, #000), #05080a 75%); }
.tcg-win img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 32%; display: block; }
.tcg-win .v2-pglyph { position: absolute; inset: 0; display: grid; place-items: center; color: #fff6dc; opacity: .85; }
.tcg-win .v2-pglyph .ui-icon { width: 42%; height: 42%; }
.tcg-win:not(.no-art) .v2-pglyph { visibility: hidden; }
.tcg-frame { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.tcg-gem { position: absolute; left: var(--gx); top: var(--gy); width: calc(var(--gd) * 1.22); aspect-ratio: 1; transform: translate(-50%, -50%); display: grid; place-items: center; }
.tcg-gem img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 1px 1.5px #000d); }
/* name on the ribbon: Cinzel, size from name length (--nl), never wider than the ribbon's flat centre */
.tcg-name { position: absolute; left: var(--nx); right: var(--nx); top: var(--ny); height: var(--nh); display: grid; place-items: center; }
.tcg-nm { grid-area: 1 / 1; max-width: 100%; white-space: nowrap; font: 700 min(8.6cqw, calc(80cqw / var(--nl))) / 1 var(--ff-head, 'Cinzel', serif); letter-spacing: .02em;
  color: #fbf1d6; background: linear-gradient(180deg, #fffaf0 0 46%, #e9cf98 54% 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 .6px var(--rib)) drop-shadow(0 0 .6px var(--rib)) drop-shadow(0 1px 1px #000c); padding-top: .08em; }
.tcg-nm.short { display: none; }
@container (max-width: 149px) { .tcg-nm.full { display: none; } .tcg-nm.short { display: block; } }
/* parchment: dark ink, ability name always, one short line of text from 150 px up */
.tcg-text { position: absolute; left: var(--px); top: var(--py); width: var(--pw); height: var(--ph); box-sizing: border-box; padding: 4% 7% 3%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .25em; overflow: hidden; color: #3a2513; }
.tcg-ab { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font: 700 6.4cqw/1.12 var(--ff-body, sans-serif); color: #3a2010; text-wrap: balance; }
.tcg-ab .ui-icon { width: 1em; height: 1em; vertical-align: -.14em; margin-right: .18em; opacity: .75; }
.tcg-desc { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; font: 500 4.9cqw/1.24 var(--ff-body, sans-serif); color: #4b331c; text-wrap: pretty; }
@container (max-width: 149px) { .tcg-desc { display: none; } .tcg-ab { font-size: 8.2cqw; line-height: 1.08; } .tcg-text { padding: 3% 5%; } }
/* round badges: level (left), stars (right); numerals sit in the painted dark sockets */
.tcg-badge { position: absolute; top: var(--by); width: var(--bd); aspect-ratio: 1; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums; line-height: 1; text-shadow: 0 1px 1px #000, 0 0 3px #000; }
.tcg-lv { left: var(--bl); } .tcg-st { left: var(--br); }
.tcg-badge small { font: 700 5.6cqw/1 var(--ff-head, serif); color: #e9d7ae; letter-spacing: .02em; margin-bottom: .04em; }
.tcg-st small { color: #ffd76a; font-size: 6.2cqw; }
.tcg-badge b { font: 800 9cqw/.95 var(--ff-num, sans-serif); color: #fff7e2; }
.tcg-act { position: absolute; right: 7%; top: 6.5%; width: 15cqw; aspect-ratio: 1; transform: translate(35%, -35%); display: grid; place-items: center; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, #c99628 70%); box-shadow: 0 0 0 1.5px #3a2608, 0 0 8px #f0c95c; color: #2a1a04; }
.tcg-act .ui-icon { width: 62%; height: 62%; stroke-width: 3; }
.tcg.missing .tcg-win img { filter: grayscale(1) brightness(.3) contrast(1.1); }
.tcg.missing .tcg-frame { filter: grayscale(.85) brightness(.55); }
.tcg.missing .tcg-gem { opacity: .4; filter: grayscale(1); }
.tcg.missing .tcg-nm { filter: grayscale(1) brightness(.7) drop-shadow(0 1px 1px #000c); }
.tcg.missing .tcg-text { opacity: .55; filter: grayscale(1); }
.tcg.missing { filter: drop-shadow(0 5px 7px #000b); }
/* placements */
#game .bk-card.tcg-btn { display: block; padding: 0; }
#game .bk-card.tcg-btn:active .tcg { transform: scale(.96); }
#game .bk-card.tcg-btn:focus-visible .tcg { outline: 2px solid var(--accent-hi); outline-offset: 2px; border-radius: 6px; }
#game .bd-hero .tcg { width: min(240px, 64vw); margin: 2px auto 10px; }
#game .well-card { display: block; width: min(44vw, 176px); margin-bottom: 6px; }
.bd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
@container (min-width: 200px) { .tcg-desc { -webkit-line-clamp: 4; } }
/* while the flip reveal runs, the Well's own UI must not show through the overlay */
#game .well-screen:has(> .well-reveal.vfx:not([hidden])) > :not(.well-reveal):not(.v2-sheet) { visibility: hidden; }
