:root {
  --bg: #0b0c0f;
  --bg-elev: #12141a;
  --bg-card: #161922;
  --line: rgba(232, 220, 196, 0.12);
  --line-strong: rgba(232, 220, 196, 0.28);
  --ink: #ebe4d6;
  --ink-dim: rgba(235, 228, 214, 0.62);
  --ink-mute: rgba(235, 228, 214, 0.38);
  --gold: #c9a66b;
  --gold-soft: rgba(201, 166, 107, 0.18);
  --ember: #d4744a;
  --ember-soft: rgba(212, 116, 74, 0.16);
  --ok: #7d9b78;
  --danger: #c45c4a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --max: 920px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(201, 166, 107, 0.08), transparent 55%),
    radial-gradient(900px 500px at 100% 20%, rgba(212, 116, 74, 0.06), transparent 50%),
    linear-gradient(180deg, #0d0f14 0%, var(--bg) 40%, #08090c 100%);
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 1;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.app {
  position: relative;
  z-index: 2;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.brand strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.brand span {
  font-size: 0.72rem;
  color: var(--ink-mute);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.nav button {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.86rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.nav button:hover { color: var(--ink); border-color: var(--line); }
.nav button.active {
  color: var(--ink);
  border-color: var(--line-strong);
  background: rgba(255,255,255,0.03);
}

.view { display: none; animation: rise 0.35s ease; }
.view.active { display: block; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.hero {
  padding: 28px 0 12px;
  text-align: center;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 22px;
}
.eyebrow::before, .eyebrow::after {
  content: "";
  width: 18px;
  height: 1px;
  background: var(--gold);
  opacity: 0.55;
}
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.85rem, 5vw, 3rem);
  line-height: 1.22;
  margin: 0 0 16px;
  letter-spacing: 0.01em;
}
.hero .sub {
  max-width: 34em;
  margin: 0 auto 28px;
  color: var(--ink-dim);
  font-size: 1.02rem;
  line-height: 1.65;
}

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 36px 0 28px;
  text-align: left;
}
@media (max-width: 720px) {
  .steps { grid-template-columns: 1fr; }
}
.step {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
}
.step .n {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}
.step h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
}
.step p {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 13px 22px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #d8b57a 0%, var(--gold) 100%);
  color: #1a140c;
  box-shadow: 0 10px 30px rgba(201, 166, 107, 0.22);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { background: rgba(255,255,255,0.04); }
.btn-ember {
  background: linear-gradient(180deg, #e08a62 0%, var(--ember) 100%);
  color: #1a0e0a;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}

.footer-note {
  margin-top: 48px;
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.86rem;
  letter-spacing: 0.04em;
}

.panel {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel + .panel { margin-top: 16px; }
.panel h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  margin: 0 0 8px;
}
.panel .lead {
  margin: 0 0 20px;
  color: var(--ink-dim);
  line-height: 1.55;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .lang-grid { grid-template-columns: repeat(2, 1fr); }
}
.lang-card {
  appearance: none;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  padding: 14px 12px;
  cursor: pointer;
  font: inherit;
}
.lang-card strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.lang-card span { color: var(--ink-mute); font-size: 0.78rem; }
.lang-card.active {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), transparent 70%), var(--bg-card);
  box-shadow: inset 0 0 0 1px rgba(201,166,107,0.25);
}

.prompt-box {
  position: relative;
  background: #0a0b0e;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  padding: 14px 14px 48px;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--ink-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt-box .copy-btn {
  position: absolute;
  right: 10px;
  bottom: 10px;
}

label.field {
  display: block;
  margin-bottom: 14px;
}
label.field .label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.86rem;
}
label.field .label em {
  font-style: normal;
  color: var(--ember);
  font-size: 0.78rem;
}
textarea, input[type="text"] {
  width: 100%;
  background: #0a0b0e;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
}
textarea:focus, input[type="text"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
textarea.invalid, .lang-grid.invalid {
  outline: 2px solid rgba(196, 92, 74, 0.55);
  outline-offset: 2px;
}
.hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--ink-mute);
}
.hint.error { color: var(--danger); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #1c1f29;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.86rem;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 50;
  box-shadow: var(--shadow);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feed-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.feed-head p { margin: 6px 0 0; color: var(--ink-dim); font-size: 0.9rem; }

.rank-list { display: flex; flex-direction: column; gap: 12px; }
.card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 14px;
  align-items: start;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.card:hover { border-color: var(--line-strong); background: #1a1d28; }
.rank {
  font-family: var(--mono);
  font-size: 0.95rem;
  color: var(--gold);
  padding-top: 2px;
}
.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--ink-mute);
  font-size: 0.75rem;
  margin-bottom: 8px;
}
.card .meta .pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}
.card .excerpt {
  margin: 0;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.like-btn {
  appearance: none;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  padding: 10px 12px;
  min-width: 64px;
  cursor: pointer;
  font: inherit;
  text-align: center;
}
.like-btn:hover { border-color: var(--ember); background: var(--ember-soft); }
.like-btn.liked {
  border-color: var(--ember);
  color: #f0c2b0;
  background: var(--ember-soft);
}
.like-btn .n { display: block; font-family: var(--mono); font-size: 0.95rem; }
.like-btn .t { font-size: 0.68rem; color: var(--ink-mute); letter-spacing: 0.08em; }

.detail-back {
  margin-bottom: 16px;
}
.detail-roast {
  white-space: pre-wrap;
  line-height: 1.7;
  font-size: 1.02rem;
  color: var(--ink);
  margin: 0;
}
.context-box {
  margin-top: 18px;
  padding: 14px;
  border-left: 3px solid var(--gold);
  background: rgba(201,166,107,0.06);
  border-radius: 0 10px 10px 0;
}
.context-box h4 {
  margin: 0 0 8px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
}
.context-box ol {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-dim);
  line-height: 1.55;
}
.season {
  margin-top: 20px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.02);
}
.season h3 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
}
.season p { margin: 0 0 12px; color: var(--ink-dim); font-size: 0.92rem; line-height: 1.5; }
.season .placeholder {
  color: var(--ink-mute);
  font-size: 0.84rem;
  font-family: var(--mono);
}

.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-mute);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.demo-badge {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 7px;
  vertical-align: middle;
}


/* —— v2: lang switch, tips, comments, modal —— */
.topbar { flex-wrap: wrap; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
}
.lang-switch button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-mute);
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  cursor: pointer;
}
.lang-switch button + button { border-left: 1px solid var(--line); }
.lang-switch button.active {
  color: #1a140c;
  background: linear-gradient(180deg, #d8b57a 0%, var(--gold) 100%);
  font-weight: 600;
}

.advice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(201,166,107,0.35);
  background: linear-gradient(180deg, rgba(201,166,107,0.1), rgba(201,166,107,0.03));
  color: var(--ink-dim);
  font-size: 0.88rem;
  line-height: 1.55;
}
.advice strong { color: var(--gold); font-weight: 600; }

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 14px 0 4px;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.45;
  cursor: pointer;
}
.check-row input {
  margin-top: 3px;
  accent-color: var(--gold);
  width: 16px;
  height: 16px;
}

.disclaimer {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(196, 92, 74, 0.45);
  background: rgba(196, 92, 74, 0.1);
  color: #f0c8c0;
  font-size: 0.86rem;
  line-height: 1.55;
}
.disclaimer .ttl {
  display: block;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  color: #ffd2c8;
}

.comments {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.comments h3 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.15rem;
}
.comment {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.comment:last-child { border-bottom: none; }
.comment .body {
  margin: 0;
  color: var(--ink-dim);
  line-height: 1.55;
  font-size: 0.92rem;
  white-space: pre-wrap;
}
.comment .votes {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.vote {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.03);
  color: var(--ink-dim);
  border-radius: 10px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  min-width: 58px;
  text-align: center;
}
.vote:hover { border-color: var(--line-strong); color: var(--ink); }
.vote.up.active { border-color: var(--ok); color: #b7d0b2; background: rgba(125,155,120,0.12); }
.vote.down.active { border-color: var(--danger); color: #f0c2b0; background: var(--ember-soft); }

.comment-form {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}
.comment-form textarea { min-height: 72px; }

.card-comments-preview {
  margin-top: 10px;
  color: var(--ink-mute);
  font-size: 0.78rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.62);
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
  width: min(480px, 100%);
  background: #151821;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.modal h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 500;
}
.modal ol {
  margin: 0 0 16px;
  padding-left: 1.2em;
  color: var(--ink-dim);
  line-height: 1.55;
  font-size: 0.92rem;
}
.modal .btn-row { justify-content: flex-end; }

.card {
  grid-template-columns: 56px 1fr auto;
}
@media (max-width: 640px) {
  .card { grid-template-columns: 40px 1fr; }
  .card .like-btn { grid-column: 2; justify-self: start; }
}


.claim-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #0a0b0e;
}
.claim-row {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--ink-mute);
}
.claim-row code {
  display: block;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--ink);
  word-break: break-all;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
}
.claim-key.masked {
  -webkit-text-security: disc;
  text-security: disc;
  letter-spacing: 0.12em;
}
.edit-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(125,155,120,0.45);
  background: rgba(125,155,120,0.12);
  color: #cfe0cb;
  font-size: 0.86rem;
}
