:root {
  font-family: "Segoe UI", Inter, system-ui, sans-serif;
  color: #242824;
  background: #f6f4ef;
  --ink: #242824;
  --muted: #636b65;
  --line: #dcded7;
  --surface: #fff;
  --paper: #f6f4ef;
  --accent: #b74734;
  --accent-dark: #903322;
  --accent-soft: #f8eae6;
  --sidebar-width: 276px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scrollbar-gutter: stable; }
body { display: flex; flex-direction: column; min-width: 320px; min-height: 100vh; min-height: 100svh; margin: 0; }
main { flex: 1 0 auto; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
p { line-height: 1.6; }
h1, h2, h3 { margin: 0 0 16px; line-height: 1.18; letter-spacing: -.025em; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 100; top: 12px; left: 16px; padding: 10px 14px; background: var(--ink); color: #fff; opacity: 0; pointer-events: none; transform: translateY(-80px); }
.skip-link:focus-visible { opacity: 1; pointer-events: auto; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.button, button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid #bdc3ba;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: background .16s, border-color .16s, transform .16s;
}
.button:hover, button.button:hover { background: #f3f5f0; border-color: #929d91; }
.button:active { transform: translateY(1px); }
.button:disabled, button:disabled { opacity: .55; cursor: default; transform: none; }
#claimForm .button, #openPack, #authSubmit { border-color: var(--accent); background: var(--accent); color: #fff; }
#claimForm .button:hover, #openPack:hover, #authSubmit:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
input { width: 100%; min-height: 43px; padding: 10px 12px; border: 1px solid #bdc3ba; border-radius: 8px; background: #fff; color: var(--ink); }
input::placeholder { color: #818982; }
input:focus { border-color: var(--accent); }

.site-header { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 22px; min-height: 76px; padding: 0 36px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: inline-flex; align-items: center; width: fit-content; color: var(--ink); font-size: 21px; font-weight: 750; letter-spacing: -.045em; text-decoration: none; white-space: nowrap; }
.main-nav { display: flex; align-items: center; gap: 28px; }
.main-nav a { display: inline-flex; align-items: center; min-height: 76px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { border-color: var(--accent); color: var(--ink); }
.header-actions { display: flex; justify-content: flex-end; justify-self: end; min-width: 112px; }
.header-actions > .button, .account-menu > summary { width: 112px; }
.account-menu { position: relative; }
.account-menu > summary { gap: 8px; list-style: none; cursor: pointer; user-select: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:active { transform: none; }
.account-menu-chevron { display: block; flex: 0 0 14px; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transform-origin: center; }
.account-menu[open] .account-menu-chevron { transform: rotate(180deg); }
.account-dropdown { position: absolute; z-index: 50; top: calc(100% + 8px); right: 0; width: 234px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 12px 28px #24282421; }
.account-menu-info { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.account-menu-info strong { overflow-wrap: anywhere; }
.account-menu-info span { color: var(--muted); }
.account-dropdown > a, .account-dropdown > button { display: block; width: 100%; padding: 12px 16px; border: 0; background: #fff; color: var(--ink); font-size: 14px; text-align: left; text-decoration: none; }
.account-dropdown > a:hover, .account-dropdown > button:hover { background: var(--paper); }
.auth-loading .header-actions, .auth-loading .profile-overview, .auth-loading .tokens-section, .auth-loading .chat-join { visibility: hidden; }

.section-wrap { width: 100%; max-width: 1160px; margin: 0 auto; padding: 64px clamp(24px, 4vw, 56px); }
.dev-overview, .profile-overview, .tokens-section, .pack-section { border-bottom: 1px solid var(--line); }
.dev-overview { padding-top: 76px; padding-bottom: 76px; }
.dev-overview h1, .profile-overview h1 { font-size: clamp(36px, 3.7vw, 52px); }
.dev-overview > p, .profile-overview > p { max-width: 680px; margin: 0; color: var(--muted); font-size: 16px; }
.dev-status { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 34px; }
.dev-status > div { min-height: 145px; padding: 23px 25px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.dev-status > div:first-child { border-top: 3px solid var(--accent); }
.dev-status h2 { margin-bottom: 12px; font-size: 19px; }
.dev-status p { margin: 0; color: var(--muted); font-size: 14px; }

.profile-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 32px; }
.profile-info-card { min-width: 0; padding: 24px 26px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.profile-info-card h2 { margin-bottom: 22px; font-size: 18px; }
.profile-info-card dl, .account-dialog-details { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 12px 16px; margin: 0; }
.profile-info-card dt, .account-dialog-details dt { color: var(--muted); font-size: 13px; }
.profile-info-card dd, .account-dialog-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; }
.profile-token-balance { display: flex; align-items: baseline; gap: 8px; margin: -4px 0 19px; }
.profile-token-balance strong { font-size: 42px; line-height: 1; letter-spacing: -.055em; }
.profile-token-balance span { color: var(--muted); font-size: 14px; }

.tokens-heading { margin-bottom: 24px; }
.tokens-heading h2 { margin-bottom: 10px; font-size: clamp(28px, 3vw, 37px); }
.tokens-heading p { max-width: 680px; margin: 0; color: var(--muted); font-size: 15px; }
.token-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(260px, .9fr); gap: 16px; }
.claim-panel, .future-panel { min-width: 0; padding: 25px 27px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.claim-panel h3, .future-panel h3 { margin-bottom: 10px; font-size: 21px; }
.claim-panel > p, .future-panel p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.future-panels { display: grid; gap: 16px; }
.future-panel p { margin-bottom: 0; }
.balance-card, .account-balance { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 9px; margin: 18px 0; background: var(--paper); font-size: 14px; }
.balance-card strong { font-size: 20px; }
.turnstile-widget { min-height: 66px; max-width: 100%; margin: 16px 0 14px; overflow: hidden; }
#claimForm .button { width: 100%; }
.refresh-button { padding: 9px 0; border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.refresh-button:hover { color: var(--ink); }
#claimCooldown p { margin: 3px 0 6px; color: var(--muted); font-size: 13px; }
.cooldown-clock { font-size: 32px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.form-message { min-height: 20px; margin: 12px 0 0 !important; color: #a13427; font-size: 13px !important; }
.form-message.success { color: #2f6c45; }
.profile-route .token-grid { grid-template-columns: minmax(0, 680px); }
.profile-route .future-panels, .profile-route .balance-card { display: none; }

.pack-section-inner { display: grid; grid-template-columns: minmax(230px, .8fr) minmax(0, 1.2fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
.pack-intro h1 { font-size: clamp(30px, 3vw, 39px); }
.pack-intro > p { max-width: 420px; margin: 0; color: var(--muted); font-size: 15px; }
.pack-controls { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.pack-help { margin: 14px 0 0 !important; color: var(--muted); font-size: 13px; }
.pack-stage { position: relative; display: grid; place-items: center; height: 400px; min-width: 0; overflow: hidden; border: 1px solid #dbd8cf; border-radius: 16px; background: radial-gradient(circle at 50% 44%, #fff 0, #f4f0e9 72%); }
.pack-stage::before { content: ""; position: absolute; inset: 18px; border: 1px dashed #d7d2c9; border-radius: 11px; pointer-events: none; }
.demo-pack { position: relative; width: 180px; height: 258px; padding: 0; border: 0; background: transparent; color: #fff; transform: rotate(-5deg); transition: transform .18s; }
.demo-pack:hover { transform: rotate(-2deg) translateY(-5px); }
.demo-pack:focus-visible { outline: 3px solid var(--accent); outline-offset: 7px; }
.demo-pack-top, .demo-pack-bottom { position: absolute; left: 0; z-index: 1; width: 100%; height: 16px; border: 1px solid #7d3329; background: repeating-linear-gradient(90deg, #d97863 0 4px, #ae4939 4px 7px); }
.demo-pack-top { top: 0; transform-origin: 15% 100%; }
.demo-pack-bottom { bottom: 0; }
.demo-pack-body { position: absolute; inset: 15px 0; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 23px 10px 18px; border: 2px solid #903b2e; background: linear-gradient(115deg, #963d30, #c75b46 32%, #b74734 70%, #8d352a); box-shadow: 8px 13px 18px #563c352f, inset 4px 0 #ffffff24, inset -4px 0 #00000018; }
.demo-pack-title { font-size: 18px; font-weight: 800; letter-spacing: .04em; }
.demo-pack-mark { display: grid; place-items: center; width: 98px; height: 98px; border: 2px solid #fff9; border-radius: 50%; font-family: Georgia, serif; font-size: 62px; line-height: 1; }
.demo-pack-count { font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.pack-stage-status { position: absolute; right: 28px; bottom: 27px; color: var(--muted); font-size: 12px; }
.pack-stage[data-phase="opening"] .demo-pack { pointer-events: none; animation: test-pack-open .95s ease-in forwards; }
.pack-stage[data-phase="opening"] .demo-pack-top { animation: test-pack-tear .65s .2s ease-out forwards; }
.pack-stage[data-phase="revealed"] .demo-pack { display: none; }
.reveal-cards { display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%; min-width: 0; padding: 0 24px; }
.reveal-cards[hidden] { display: none; }
.reveal-card { flex: 0 1 86px; min-width: 0; height: 125px; border: 1px solid #d7d2c9; border-radius: 6px; background: #fff; box-shadow: 4px 8px 14px #33282020; opacity: 0; transform: translateY(32px) scale(.9); }
.reveal-card:nth-child(1) { --card-tilt: -8deg; }
.reveal-card:nth-child(2) { --card-tilt: -4deg; }
.reveal-card:nth-child(3) { --card-tilt: 0deg; }
.reveal-card:nth-child(4) { --card-tilt: 4deg; }
.reveal-card:nth-child(5) { --card-tilt: 8deg; }
.reveal-card.is-dealt { animation: test-card-deal .5s cubic-bezier(.18,.82,.24,1) forwards; }
@keyframes test-pack-open { 0% { transform: rotate(-5deg) scale(1); opacity: 1; } 42% { transform: rotate(3deg) scale(1.04); opacity: 1; } 70% { transform: translateY(-8px) rotate(0) scale(1.1); opacity: 1; } 100% { transform: translateY(24px) scale(1.12); opacity: 0; } }
@keyframes test-pack-tear { to { transform: translate(52px, -74px) rotate(25deg); opacity: 0; } }
@keyframes test-card-deal { to { opacity: 1; transform: translateY(0) rotate(var(--card-tilt)); } }

footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; padding: 20px 36px; color: var(--muted); font-size: 12px; }

.chat-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; display: flex; flex-direction: column; width: var(--sidebar-width); background: #eef0eb; border-right: 1px solid var(--line); }
.chat-heading { flex: none; padding: 23px 21px; border-bottom: 1px solid var(--line); }
.chat-heading-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chat-heading h2 { margin: 0; font-size: 25px; }
.chat-board { display: flex; flex: 1; min-height: 0; flex-direction: column; }
.chat-messages { flex: 1; min-height: 0; padding: 0 21px; overflow-y: auto; overflow-anchor: none; scrollbar-width: none; }
.chat-messages::-webkit-scrollbar { display: none; }
.chat-empty { display: grid; place-items: center; height: 100%; padding: 20px; color: var(--muted); text-align: center; font-size: 13px; }
.chat-row { padding: 16px 0; border-bottom: 1px solid var(--line); }
.chat-row-head { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.chat-row-head strong { overflow-wrap: anywhere; }
.chat-row-head time { color: var(--muted); font-size: 11px; }
.chat-row p { margin: 6px 0 0; overflow-wrap: anywhere; font-size: 13px; }
.chat-join, #chatLoggedIn { border-top: 1px solid var(--line); padding: 17px 21px 20px; }
.chat-join { display: flex; flex-direction: column; gap: 10px; color: var(--muted); font-size: 13px; }
.chat-identity { margin-bottom: 10px; color: var(--muted); font-size: 12px; }
.chat-identity strong { color: var(--ink); }
.chat-form { display: grid; gap: 8px; }
.chat-form .button, .chat-join .button { width: 100%; }
.chat-close, .chat-toggle, .chat-overlay { display: none; }

dialog { width: min(440px, calc(100vw - 24px)); max-height: calc(100vh - 24px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px #1418143b; }
dialog::backdrop { background: #1d251e7a; }
.dialog-content, .account-dialog-inner { position: relative; padding: 31px; }
.dialog-close { position: absolute; top: 15px; right: 16px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 25px; }
.dialog-close:hover { background: var(--paper); color: var(--ink); }
.dialog-content h2, .account-dialog h2 { padding-right: 35px; margin-bottom: 22px; font-size: 27px; }
.dialog-content > p { color: var(--muted); font-size: 14px; }
.auth-tabs { display: flex; gap: 23px; margin-bottom: 19px; border-bottom: 1px solid var(--line); }
.auth-tabs button { min-height: 39px; padding: 5px 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 14px; }
.auth-tabs button.active { border-color: var(--accent); color: var(--ink); font-weight: 700; }
#authForm > div { margin-bottom: 15px; }
#authForm label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
#authForm .button, .account-dialog .button { width: 100%; }
.account-dialog-details { margin-bottom: 20px; }
.account-balance { display: block; margin: 0 0 18px; }
.account-balance small { display: block; color: var(--muted); font-size: 12px; }
.account-balance strong { display: block; margin-top: 4px; font-size: 26px; }
.logout-button { display: inline-block; margin-top: 15px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; }
.logout-button:hover { color: var(--ink); }
.verification-page { width: min(560px, calc(100% - 40px)); margin: 70px auto; padding: 28px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.verification-page h1 { font-size: 30px; }

@media (min-width: 851px) {
  .site-header, main, footer { margin-left: var(--sidebar-width); }
}
@media (max-width: 1100px) {
  .site-header { grid-template-columns: minmax(0, 1fr) auto; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; }
  .main-nav a { min-height: 46px; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .profile-details { grid-template-columns: 1fr; }
}
@media (max-width: 850px) {
  .chat-sidebar { width: min(340px, calc(100vw - 32px)); transform: translateX(-101%); transition: transform .22s ease; box-shadow: 10px 0 30px #00000012; }
  .chat-sidebar.open { transform: translateX(0); }
  .main-nav .chat-toggle { display: inline-flex; align-items: center; min-height: 46px; padding: 0; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-size: 14px; font-weight: 600; }
  .main-nav .chat-toggle:hover, .main-nav .chat-toggle[aria-expanded="true"] { color: var(--ink); }
  .chat-close { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--ink); font-size: 24px; }
  .chat-overlay:not([hidden]) { position: fixed; inset: 0; z-index: 39; display: block; background: #17201983; }
  body.chat-open { overflow: hidden; }
  .token-grid, .pack-section-inner { grid-template-columns: 1fr; }
  .future-panels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .site-header { gap: 0 12px; min-height: 0; padding: 10px 20px 0; }
  .brand { font-size: 20px; }
  .header-actions { min-width: 95px; }
  .header-actions > .button, .account-menu > summary { width: 95px; min-height: 38px; padding: 7px 10px; font-size: 13px; }
  .main-nav { justify-content: space-between; gap: 12px; margin-top: 10px; border-top: 1px solid var(--line); }
  .main-nav a, .main-nav .chat-toggle { min-height: 48px; font-size: 13px; }
  .section-wrap { padding: 44px 20px; }
  .dev-overview { padding-top: 56px; }
  .dev-status, .future-panels { grid-template-columns: 1fr; }
  .dev-status > div { min-height: 0; }
  .profile-details { margin-top: 24px; }
  .profile-info-card, .claim-panel, .future-panel { padding: 21px; }
  .profile-info-card dl, .account-dialog-details { grid-template-columns: 90px minmax(0, 1fr); }
  .pack-stage { height: 335px; }
  .pack-stage::before { inset: 13px; }
  .pack-stage-status { right: 22px; bottom: 20px; }
  .reveal-cards { gap: 5px; padding: 0 15px; }
  .reveal-card { height: 100px; }
  footer { flex-wrap: wrap; min-height: 74px; padding: 20px; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .chat-sidebar, .button, .demo-pack { transition: none; }
  .pack-stage[data-phase="opening"] .demo-pack, .pack-stage[data-phase="opening"] .demo-pack-top, .reveal-card.is-dealt { animation: none; }
  .reveal-card.is-dealt { opacity: 1; transform: rotate(var(--card-tilt)); }
}
