/* ============================================================
   VORTEX SELF-HELP — APP PROTOTYPE STYLES
   Layers on top of ds.css (tokens + .va-btn / .field / .echip / .lammy …)
   ============================================================ */

html, body { height: 100%; }
body {
  background: var(--paper);
  margin: 0; overflow: hidden;
}

/* ---------- APP SHELL (fills its viewport / iframe — responsive) ---------- */
#root { height: 100vh; }
.screen {
  width: 100%; height: 100%;
  background: var(--paper);
  overflow: hidden;
  display: flex; flex-direction: column;
  position: relative;
}

/* ---------- TOP BAR ---------- */
.topbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-5) var(--s-6); background: var(--va-crest); color: #F4E8CF;
  border-bottom: 3px solid var(--gilt);
}
.topbar .crest { width: 38px; height: auto; flex: 0 0 auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.4)); }
.topbar .tb-title { font-family: var(--f-display); font-weight: 700; font-size: 19px; color: #fff; line-height: 1.1; }
.topbar .tb-sub { font-family: var(--f-text); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gilt-light); margin-top: 2px; }
.topbar .spacer { flex: 1 1 auto; }
.tb-btn {
  font-family: var(--f-text); font-weight: 600; font-size: 14px;
  background: rgba(255,255,255,.10); color: #F4E8CF; border: 1px solid rgba(244,232,207,.25);
  border-radius: var(--r-md); padding: 9px 14px; min-height: 42px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
  transition: background .15s;
}
.tb-btn:hover { background: rgba(255,255,255,.2); }
.tb-back { font-family: var(--f-text); font-weight: 600; font-size: 15px; background: rgba(255,255,255,.1); color: #F4E8CF; border: 1px solid rgba(244,232,207,.25); border-radius: var(--r-md); padding: 9px 16px 9px 12px; min-height: 44px; cursor: pointer; }
.tb-back:hover { background: rgba(255,255,255,.2); }

/* ---------- SCROLL BODY ---------- */
/* On wide (desktop/kiosk) viewports the content is capped to a centered reading
   column; horizontal padding grows to absorb the extra width. On mobile it goes
   edge-to-edge with comfortable gutters. */
.body {
  flex: 1 1 auto; overflow-y: auto;
  padding: var(--s-7) max(var(--s-8), calc((100% - 860px) / 2)) var(--s-9);
}
.body::-webkit-scrollbar { width: 10px; }
.body::-webkit-scrollbar-thumb { background: var(--vellum-line-2); border-radius: 10px; border: 3px solid var(--paper); }

.screen-title { font-family: var(--f-display); font-weight: 700; font-size: 32px; margin: 0 0 6px; }
.screen-desc { font-size: 17px; color: var(--ink-2); margin: 0 0 var(--s-7); max-width: 56ch; }

/* Inknut Antiqua sets very wide by default — tighten tracking + the gaps
   between words on display-font headings so titles read tighter. */
.topbar .tb-title, .screen-title, .landing-hero h1, .fs-title,
.char-head h2, .sheet h3, .row-card .rc-title, .skill-card .sc-name {
  letter-spacing: -0.012em;
  word-spacing: -0.14em;
}

/* sticky form footer */
.footer-bar {
  flex: 0 0 auto; padding: var(--s-5) var(--s-8);
  border-top: var(--bd-hair); background: var(--paper-raised);
  display: flex; gap: var(--s-4); align-items: center;
}
.footer-bar .grow { flex: 1; }

/* ---------- LANDING ---------- */
.landing-hero { text-align: center; padding: var(--s-7) 0 var(--s-6); }
.landing-hero img { width: 96px; filter: drop-shadow(0 6px 14px rgba(110,8,8,.3)); }
.landing-hero h1 { font-size: 34px; margin: var(--s-5) 0 6px; }
.landing-hero p { font-size: 17px; color: var(--ink-2); margin: 0; }
.task-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-top: var(--s-6); }
.task-tile {
  min-height: 124px; border: none; cursor: pointer; border-radius: var(--r-md);
  background: var(--va-crimson); color: #fff; font-family: var(--f-display); font-weight: 700; font-size: 22px; line-height: 1.15;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: var(--s-5);
  box-shadow: var(--sh-sm); transition: background .15s, transform .05s; position: relative; overflow: hidden;
}
.task-tile::before { content:""; position:absolute; inset:7px; border:1px solid rgba(255,255,255,.22); border-radius: var(--r-sm); pointer-events:none; }
.task-tile .gly { font-size: 30px; line-height: 1; }
.task-tile:hover { background: var(--va-crimson-hover); }
.task-tile:active { transform: translateY(1px); }
.task-tile.wide { grid-column: span 2; min-height: 86px; flex-direction: row; gap: var(--s-4); }

.print-row { margin-top: var(--s-7); padding-top: var(--s-7); border-top: var(--bd-hair); }

/* ---------- GENERIC FORM BLOCKS ---------- */
.form-section { margin-top: var(--s-7); }
.form-section + .form-section { margin-top: var(--s-8); }
.fs-title { font-family: var(--f-display); font-weight: 600; font-size: 20px; margin: 0 0 var(--s-3); }
.fs-help { font-size: 14px; color: var(--ink-3); margin: 0 0 var(--s-5); }
.field.full { max-width: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-5); }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s-5); }
textarea.ctl { resize: vertical; min-height: 84px; line-height: 1.5; }

.ledger {
  background: var(--paper-sunken); border: var(--bd-hair); border-radius: var(--r-md);
  padding: var(--s-5); margin-top: var(--s-5);
}
.ledger h4 { font-family: var(--f-text); font-weight: 600; font-size: 14px; color: var(--ink-2); margin: 0 0 var(--s-3); }
.ledger .line { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 14px; padding: 4px 0; }
.ledger .line .amt { font-weight: 600; }

/* ---------- SELECT (controlled) ---------- */
.sel-wrap { position: relative; max-width: 360px; }
.sel-wrap.full { max-width: none; }
.sel-panel-pop {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--paper-raised); border: var(--bd-hair); border-radius: var(--r-lg);
  box-shadow: var(--sh-md); padding: var(--s-3); max-height: 280px; overflow-y: auto;
}

/* ---------- CARDS / LIST ---------- */
.list { display: flex; flex-direction: column; gap: var(--s-4); }
.row-card {
  background: var(--paper-raised); border: var(--bd-hair); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm); padding: var(--s-5) var(--s-6); cursor: pointer; transition: box-shadow .15s, transform .05s;
  display: flex; align-items: center; gap: var(--s-5);
}
.row-card:hover { box-shadow: var(--sh-md); }
.row-card:active { transform: translateY(1px); }
.row-card .rc-main { flex: 1; min-width: 0; }
.row-card .rc-title { font-family: var(--f-display); font-weight: 600; font-size: 18px; }
.row-card .rc-meta { font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.row-card .rc-code { font-family: var(--f-mono); font-size: 13px; color: var(--va-crimson); }
.row-card .chev { color: var(--ink-faint); font-size: 22px; }
.pill { display:inline-block; font-family: var(--f-mono); font-size: 11px; letter-spacing:.05em; padding: 3px 9px; border-radius: var(--r-seal); background: var(--gilt-wash); color: #6b551d; }

/* ---------- CHARACTER ---------- */
.char-head {
  display: flex; gap: var(--s-6); align-items: center; padding: var(--s-6);
  background: linear-gradient(160deg, #7A0A0A, var(--va-crest)); color: #F4E8CF; border-radius: var(--r-lg);
  box-shadow: var(--sh-md);
}
.char-portrait { width: 84px; height: 84px; border-radius: var(--r-lg); background: var(--paper-sunken); border: 2px solid var(--gilt); flex: 0 0 auto; overflow: hidden; }
.char-portrait img { width: 100%; height: 100%; object-fit: cover; }
.char-head h2 { color: #fff; font-size: 26px; margin: 0; }
.char-head .ch-sub { color: var(--gilt-light); font-size: 14px; margin-top: 4px; }
.char-stats { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--s-3); margin-top: var(--s-5); }
.stat { background: var(--paper-raised); border: var(--bd-hair); border-radius: var(--r-md); padding: var(--s-4); text-align: center; }
.stat .v { font-family: var(--f-display); font-weight: 700; font-size: 22px; color: var(--va-crimson); }
.stat .k { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }
.tabs { display: flex; gap: 2px; margin-top: var(--s-7); border-bottom: var(--bd-rule); }
.tab { font-family: var(--f-text); font-weight: 600; font-size: 15px; color: var(--ink-3); background: none; border: none; padding: 11px 16px; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--va-crimson); border-bottom-color: var(--va-crimson); }
.skill-card { background: var(--paper-raised); border: var(--bd-hair); border-radius: var(--r-lg); padding: var(--s-5); box-shadow: var(--sh-sm); }
.skill-card .sc-top { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-4); }
.skill-card .sc-name { font-family: var(--f-display); font-weight: 600; font-size: 17px; }
.skill-card .sc-cost { font-family: var(--f-mono); font-size: 13px; color: var(--ink-2); }
.skill-card .sc-desc { font-size: 14px; color: var(--ink-2); margin-top: var(--s-3); }

/* ---------- LOGIN ---------- */
.login-wrap { max-width: 380px; margin: var(--s-9) auto 0; text-align: center; }
.login-wrap img { width: 88px; }
.oauth-btn {
  width: 100%; min-height: 56px; border-radius: var(--r-md); border: var(--bd-ctl); background: var(--paper-raised);
  font-family: var(--f-text); font-weight: 600; font-size: 17px; color: var(--ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: var(--s-4); margin-top: var(--s-4); transition: background .15s;
}
.oauth-btn:hover { background: var(--paper-sunken); }
.oauth-btn .ic { width: 22px; height: 22px; border-radius: 5px; flex: 0 0 auto; }
.oauth-btn .oa-logo { flex: 0 0 auto; }

/* ---------- SUCCESS ---------- */
.success-wrap { text-align: center; max-width: 460px; margin: var(--s-7) auto 0; }
.success-seal { width: 96px; height: 96px; border-radius: var(--r-seal); margin: 0 auto var(--s-6); background: radial-gradient(circle at 35% 30%, #B52020, var(--va-crest)); display: flex; align-items: center; justify-content: center; box-shadow: var(--sh-md), inset 0 0 0 3px var(--gilt-light); color: #fff; font-size: 44px; }
.code-big { background: var(--paper-sunken); border: var(--bd-hair); border-radius: var(--r-md); padding: var(--s-6); margin: var(--s-6) 0; }
.code-big .lab { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.code-big .val { font-family: var(--f-mono); font-weight: 600; font-size: 30px; letter-spacing: .12em; color: var(--va-crimson); }

/* radios / choices */
.choice-set { display: flex; flex-wrap: wrap; gap: var(--s-3); }
.choice {
  font-family: var(--f-text); font-weight: 600; font-size: 15px; padding: 11px 18px; min-height: 46px;
  border-radius: var(--r-md); border: var(--bd-ctl); background: var(--paper-raised); color: var(--ink-2); cursor: pointer; transition: all .12s;
}
.choice.on { background: var(--va-crimson); color: #fff; border-color: var(--va-crimson); }

/* settings sheet */
.sheet-scrim { position: absolute; inset: 0; background: rgba(34,28,20,.55); z-index: 40; display: flex; align-items: flex-start; justify-content: flex-end; }
.sheet { width: 340px; height: 100%; background: var(--paper-raised); box-shadow: var(--sh-lg); padding: var(--s-7); overflow-y: auto; border-left: 3px solid var(--gilt); }
.sheet h3 { font-size: 22px; margin: 0 0 var(--s-5); }
.sw-row { display: flex; align-items: center; justify-content: space-between; padding: var(--s-4) 0; border-bottom: var(--bd-hair); }
.sw { width: 48px; height: 28px; border-radius: var(--r-seal); background: var(--vellum-line-2); position: relative; cursor: pointer; transition: background .15s; border: none; flex: 0 0 auto; }
.sw::after { content:""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: var(--r-seal); background: #fff; transition: left .15s; box-shadow: var(--sh-sm); }
.sw.on { background: var(--va-crimson); }
.sw.on::after { left: 23px; }

/* fade transition */
.fade-in { animation: fadeIn .24s ease both; }
@keyframes fadeIn { from { transform: translateY(7px); } to { transform: none; } }

/* sticky footer also follows the centered column on desktop */
.footer-bar { padding-inline: max(var(--s-8), calc((100% - 860px) / 2)); }

/* ---------- VERIFY — printed-card preview well ---------- */
.verify-preview {
  margin: 24px 0; padding: 28px;
  background: var(--paper-sunken); border: var(--bd-hair); border-radius: var(--r-lg);
}
.verify-preview .vp-label {
  text-align: center; font-family: var(--f-mono); font-size: 12px;
  color: var(--ink-3); margin-bottom: 16px; letter-spacing: .1em;
}
.verify-preview .vp-cards { display: flex; gap: 24px; flex-wrap: wrap; justify-content: center; }
.verify-preview .vp-card { display: flex; flex-direction: column; min-width: 0; }

/* ============================================================
   RESPONSIVE — MOBILE (the KMP app also targets phones)
   ============================================================ */
@media (max-width: 640px) {
  .body { padding: var(--s-6) var(--s-5) var(--s-8); }
  .footer-bar { padding: var(--s-4) var(--s-5); }
  .topbar { padding: var(--s-4) var(--s-5); gap: var(--s-3); }
  .topbar .tb-title { font-size: 17px; }
  .topbar .crest { width: 32px; }

  .screen-title { font-size: 26px; }
  .screen-desc { font-size: 16px; margin-bottom: var(--s-6); }

  /* forms collapse to a single column and fields go full-width */
  .two-col, .three-col { grid-template-columns: 1fr; gap: var(--s-4); }
  .field, .sel-wrap { max-width: none; }

  /* landing tiles stay legible: 2-up but shorter */
  .task-grid { gap: var(--s-3); }
  .task-tile { min-height: 96px; font-size: 18px; }
  .task-tile .gly { font-size: 24px; }
  .task-tile.wide { min-height: 68px; }
  .landing-hero h1 { font-size: 27px; }
  .landing-hero img { width: 76px; }

  /* character header + stats reflow */
  .char-head { flex-direction: row; padding: var(--s-5); gap: var(--s-4); }
  .char-portrait { width: 64px; height: 64px; }
  .char-head h2 { font-size: 21px; }
  .char-stats { grid-template-columns: 1fr 1fr; }
  .tabs { overflow-x: auto; }
  .tab { white-space: nowrap; }

  .success-seal { width: 80px; height: 80px; font-size: 36px; }
  .code-big .val { font-size: 24px; }

  /* keep the full-size card inside the well: shrink the padding, not the card */
  .verify-preview { padding: 16px 6px; }
  .verify-preview .vp-cards { gap: 18px; }

  /* settings drawer goes full width on phones */
  .sheet { width: 100%; }
}

@media (max-width: 360px) {
  .task-grid { grid-template-columns: 1fr; }
  .task-tile.wide { grid-column: auto; }
}
