:root {
  color-scheme: light;
  --base: #f4f1eb;
  --rail: #1c2223;
  --panel: #fffdf9;
  --input: #fbf9f4;
  --line: #e1dacf;
  --soft-line: #eee8df;
  --ink: #242723;
  --muted: #625f56;
  --accent: #80511e;
  --gold: #eab47a;
  --error: #9d3432;
  --radius: 18px;
  --coast-image: url("/alpha-coast.webp");
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  font-size: 15px;
  background: var(--base);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .55; }
a { color: var(--accent); }
h1, h2, h3, p, dl { margin: 0; }
h1, h2, h3 { line-height: 1.2; }
p { line-height: 1.65; }
h2 { font-size: 20px; font-weight: 720; }
h3 { font-size: 15px; }
:focus-visible { outline: 2px solid #9a622a; outline-offset: 3px; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.muted { color: var(--muted); }
.accent { color: var(--accent); }

.primary, .secondary, .text-button, .balance-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid transparent;
  min-height: 43px;
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}
.primary { background: #293230; color: #fffaf1; border-color: #293230; }
.primary .icon { color: #f5c48e; }
.primary:hover:not(:disabled) { background: #3e4843; border-color: #3e4843; }
.secondary, .balance-button { background: var(--panel); border-color: var(--line); color: var(--ink); }
.secondary:hover:not(:disabled), .balance-button:hover { background: #f0e9dd; }
.text-button { min-height: 34px; padding: 5px 7px; background: transparent; color: var(--muted); }
.text-button:hover { color: var(--ink); background: #eee8dd; }
.text-button.accent { color: var(--accent); }
.compact { min-height: 34px; padding: 5px 11px; font-size: 13px; }
label { display: block; font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  display: block;
  min-height: 44px;
  color: var(--ink);
  background: var(--input);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}
label input, label select { margin-top: 7px; }
form > label, form > .form-grid { margin-top: 16px; }
form > button[type="submit"] { margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.error-line { margin-top: 9px; color: var(--error); font-size: 13px; }
.error-line:empty { display: none; }
.help { margin-top: 8px; color: var(--muted); font-size: 13px; }

.brand { display: flex; align-items: center; gap: 12px; color: #fff9ef; white-space: nowrap; }
.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  aspect-ratio: 1;
  border-radius: 8px;
  background: var(--gold);
  color: #252520;
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
}
.brand-name { font-size: 17px; font-weight: 720; letter-spacing: -.025em; }

.login-screen {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr);
  width: min(1400px, calc(100% - 64px));
  min-height: clamp(540px, 78vh, 790px);
  margin: clamp(24px, 6vh, 70px) auto;
  overflow: hidden;
  border-radius: 24px;
  background: var(--panel);
  box-shadow: 0 20px 70px #392e211a, 0 0 0 1px #ded6c9;
}
.login-story {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 72px;
  padding: clamp(29px, 5vw, 75px);
  color: #fff9ef;
  background:
    linear-gradient(180deg, #17202070 0%, transparent 36%, #111d1de8 100%),
    linear-gradient(90deg, #131e1e61, transparent 70%),
    var(--coast-image) 78% 52% / cover,
    #303e3a;
}
.login-story-copy { max-width: 600px; }
.login-story h1 {
  margin-bottom: 17px;
  font-size: clamp(41px, 5.4vw, 80px);
  font-weight: 730;
  letter-spacing: -.065em;
  text-wrap: balance;
}
.login-story p { max-width: 27ch; font-size: clamp(15px, 1.45vw, 19px); color: #f0e7d9; }
.login-side { display: grid; place-items: center; padding: 40px clamp(25px, 5vw, 70px); }
.login-form { width: min(100%, 360px); }
.login-form h2 { margin-bottom: 9px; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.045em; }
.login-form > .muted { margin-bottom: 27px; }
.login-form input { min-height: 49px; }
.login-form .primary { justify-content: space-between; width: 100%; min-height: 49px; margin-top: 23px; }

.shell { display: grid; grid-template-columns: 229px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding: 29px 17px 21px;
  background: var(--rail);
  color: #faf6ee;
}
.sidebar .brand { margin: 0 10px; }
.sidebar :focus-visible, .login-story :focus-visible { outline-color: var(--gold); }
.nav { display: grid; gap: 5px; margin-top: 40px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cfcec4;
  text-align: left;
  font-weight: 620;
}
.nav-item:hover { background: #303736; color: #fff8ec; }
.nav-item[aria-current="page"] { background: #343a35; color: #ffedcf; border-color: #42473d; }
.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px -1px;
  width: 3px;
  border-radius: 3px;
  background: var(--gold);
}
.nav-item[aria-current="page"] .icon { color: var(--gold); }
.side-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 17px;
  border-top: 1px solid #424844;
}
.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #464337;
  color: #ffdbad;
  font-size: 13px;
  font-weight: 720;
}
.account { min-width: 0; flex: 1; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 13px; }
.account small { margin-top: 3px; font-size: 11px; color: #babbb0; }
.side-footer .text-button { font-size: 12px; color: #d2d2c8; }
.side-footer .text-button:hover { background: #343b37; color: #fff8ec; }

.main-view { min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 15px;
  min-height: 66px;
  padding: 12px clamp(20px, 3.7vw, 55px);
  border-bottom: 1px solid var(--line);
  background: #f9f6ef;
  font-size: 13px;
}
.crumb { color: #82786b; margin: 0 9px; }
.topbar-right { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.balance-button { min-height: 34px; padding: 5px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.balance-button .icon { width: 16px; height: 16px; color: var(--accent); }
.badge, .platform-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--muted);
  background: #f6f1e8;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.35;
  white-space: nowrap;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge.mock { background: #f6ead9; color: #794d22; border-color: #ead6ba; }
.content { max-width: 1450px; margin: auto; padding: 30px clamp(20px, 3.7vw, 55px) 48px; }
.page { display: grid; gap: 19px; }

.hero {
  display: flex;
  align-items: flex-end;
  min-height: clamp(222px, 24vw, 340px);
  padding: clamp(25px, 4.1vw, 57px);
  border-radius: var(--radius);
  color: #fff9ef;
  background:
    linear-gradient(90deg, #141f20ed 0%, #182325a8 38%, #18232512 79%),
    linear-gradient(0deg, #15202070, transparent 65%),
    var(--coast-image) 60% 51% / cover,
    #303e3a;
  box-shadow: 0 9px 27px #26302d15;
}
.hero-copy { max-width: 660px; }
.hero h1, .page-heading h1 { font-size: clamp(31px, 4vw, 57px); font-weight: 730; letter-spacing: -.05em; }
.hero p { margin-top: 11px; color: #f2e7d8; font-size: clamp(14px, 1.45vw, 16px); }
.page-heading { margin: 5px 0 8px; }
.page-heading p { margin-top: 10px; color: var(--muted); }

.panel {
  min-width: 0;
  padding: clamp(18px, 2.2vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 3px 10px #493d2b06;
}
.section-head, .heading-group { display: flex; align-items: center; gap: 10px 13px; }
.section-head { justify-content: space-between; flex-wrap: wrap; margin-bottom: 17px; }
.feature-icon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: #f4e8d8;
  color: #835320;
}
.setup-panel .feature-icon, .local-files .feature-icon { background: #e9ede4; color: #435a47; }
.download-grid { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr); gap: 19px; }
.release-panel { border-top-color: #b98555; }
.release-info { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 10px; font-variant-numeric: tabular-nums; }
.release-info strong { font-size: 24px; line-height: 1.15; letter-spacing: -.04em; overflow-wrap: anywhere; }
.release-info span { font-size: 13px; }
#release-name { overflow-wrap: anywhere; }
#client-download { margin-top: 17px; }
.release-checksum, .codex-setup { margin-top: 13px; }
.release-checksum summary, .codex-setup summary { color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 620; }
.release-checksum code { display: block; color: var(--muted); margin: 8px 0; overflow-wrap: anywhere; }
.codex-setup p { color: var(--muted); margin: 8px 0; }
.install-steps { display: grid; gap: 10px; margin: 0 0 10px; padding-left: 21px; color: var(--muted); line-height: 1.55; }
.install-steps li { padding-left: 4px; }
.install-steps li::marker { color: var(--accent); font-weight: 700; }
.install-steps code { color: var(--ink); }
.setup-panel .text-button { margin-left: -7px; }
.local-files { display: flex; align-items: flex-start; gap: 14px; background: #f7f7f0; }
.local-files h2 { font-size: 16px; margin: 1px 0 5px; }
.local-files p { color: var(--muted); font-size: 14px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
thead { color: var(--muted); background: #f7f3ec; }
th, td { border-bottom: 1px solid var(--soft-line); padding: 11px 10px; vertical-align: middle; }
th { font-weight: 650; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.time, td.number { white-space: nowrap; font-variant-numeric: tabular-nums; }
td strong { display: block; }
td small { display: block; margin-top: 3px; color: var(--muted); max-width: 36ch; overflow-wrap: anywhere; }
.empty-state { color: var(--muted); text-align: center; padding: 22px 12px; border: 1px dashed #d7cdbe; border-radius: 8px; font-size: 13px; }
.wallet-grid, .admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 19px; }
.wallet-stat { display: grid; gap: 7px; }
.wallet-stat span { color: var(--muted); }
.wallet-stat strong { font-size: clamp(24px, 3.2vw, 42px); font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.connection .form-actions { justify-content: flex-start; }
.token-output { display: flex; align-items: end; gap: 9px; margin-top: 12px; }
.token-output label { flex: 1; min-width: 0; }
code, pre, .token-output input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
pre { margin: 12px 0 5px; color: #384239; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 1fr); align-items: center; gap: 10px 20px; border-top: 1px solid var(--line); padding: 12px 0; margin-top: 10px; }
.admin-review form { display: flex; flex-wrap: wrap; align-items: end; gap: 7px; }
.admin-review label { margin: 0; flex: 1; min-width: 130px; }
.admin-review button { margin: 0; }
.admin-review code { overflow-wrap: anywhere; color: var(--muted); }
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  border: 1px solid #525951;
  border-radius: 10px;
  background: #293230;
  color: #fff7eb;
  box-shadow: 0 12px 32px #25241b38;
  z-index: 3;
  overflow-wrap: anywhere;
}
.toast.is-error { border-color: #d9ac9f; background: #fff2eb; color: var(--error); }

@media (max-width: 1050px) {
  .shell { grid-template-columns: 190px minmax(0, 1fr); }
  .admin-grid { grid-template-columns: 1fr; }
}
@media (max-width: 790px) {
  .login-screen { grid-template-columns: 1fr; width: min(620px, calc(100% - 30px)); }
  .login-story { min-height: 305px; gap: 44px; }
  .login-side { padding: 32px 23px 38px; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    height: auto;
    padding: 12px 14px 9px;
  }
  .sidebar .brand { margin: 0; }
  .side-footer { grid-column: 2; grid-row: 1; border: 0; margin: 0; padding: 0; }
  .side-footer .account { max-width: 120px; }
  .nav { grid-row: 2; grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; }
  .nav-item { min-height: 39px; gap: 5px; padding: 5px 8px; font-size: 13px; }
  .nav-item .icon { width: 16px; height: 16px; }
  .topbar { min-height: 49px; padding-top: 7px; padding-bottom: 7px; }
  .content { padding-top: 19px; }
}
@media (max-width: 660px) {
  .download-grid, .admin-review { grid-template-columns: 1fr; }
  .hero { min-height: 203px; }
}
@media (max-width: 560px) {
  .brand-name { font-size: 15px; }
  .side-footer .account { max-width: 73px; }
  .avatar { display: none; }
  .content, .topbar { padding-right: 14px; padding-left: 14px; }
  .page, .download-grid, .wallet-grid { gap: 12px; }
  .hero { min-height: 185px; padding: 23px 18px; }
  .hero h1 { font-size: clamp(27px, 7vw, 36px); }
  .local-files { gap: 10px; }
  .token-output { align-items: stretch; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
