:root {
  --bg: #070b0a;
  --panel: #101816;
  --panel-2: #16211d;
  --ink: #efe6d2;
  --muted: #b7c4b8;
  --gold: #c9a45a;
  --gold-dim: #8a6d32;
  --green: #2e6b55;
  --danger: #c45b5b;
  --line: rgba(201, 164, 90, 0.28);
  --serif: "Noto Serif KR", "Noto Serif JP", "Cormorant Garamond", Georgia, serif;
  --display: "Cinzel", "Cormorant Garamond", Georgia, serif;
  --sans: "Noto Sans KR", "Noto Sans JP", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(46, 107, 85, 0.18), transparent 60%),
    var(--bg);
}
button, select { font-family: inherit; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 10, 0.92);
  position: sticky; top: 0; z-index: 5;
  backdrop-filter: blur(10px);
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-decoration: none;
  font-size: 0.95rem;
}
.topbar .spacer { flex: 1; min-width: 8px; }
.nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  white-space: nowrap;
}
.nav-link:hover { color: var(--gold); }
.lang, .icon-btn, .ghost, .btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.btn.primary { background: var(--green); border-color: #3d8a6e; }
a.btn { display: inline-block; text-decoration: none; }
.btn.danger { background: #5a2a2a; border-color: var(--danger); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.icon-btn { padding: 6px 10px; }

.screen { max-width: 1100px; margin: 0 auto; padding: 18px 14px 40px; animation: screenIn 0.45s ease both; }
.card {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
}
h1, h2, h3 { font-family: var(--serif); margin: 0 0 10px; line-height: 1.25; }
h1 { color: var(--gold); font-size: clamp(1.6rem, 4vw, 2.4rem); }
.gate-card { padding: 0 18px 22px; overflow: hidden; }
.gate-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  margin: 0 -18px 8px;
  background: #050807;
}
.gate-hero img {
  width: 100%;
  height: 28vw;
  max-height: 210px;
  min-height: 118px;
  object-fit: cover;
  object-position: top center;
  filter: brightness(1.14) contrast(1.06) saturate(1.05);
}
.gate-logo {
  display: block;
  width: min(100%, 680px);
  margin: 2px auto 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.gate-card > h1 { text-align: center; margin-top: 4px; }
.gate-card > .lede, .gate-card > .version, .gate-card > h2 { text-align: center; }
.gate-card > .disclaimer { max-width: 46rem; margin: 0 auto; }
.gate-langs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.lang-pill {
  border: 1px solid var(--line);
  background: rgba(16, 24, 22, 0.8);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font-family: var(--serif);
  letter-spacing: 0.04em;
  font-size: 0.92rem;
}
.lang-pill:hover { color: var(--ink); border-color: var(--gold-dim); }
.lang-pill.on {
  background: var(--green);
  border-color: #3d8a6e;
  color: var(--ink);
}
.gate-cta { justify-content: center; margin-top: 4px; }
@media (max-width: 700px) {
  .gate-hero { grid-template-columns: 1fr 1fr; }
  .gate-hero img { height: 38vw; max-height: 180px; }
}
.stack { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.disclaimer {
  font-size: 0.82rem;
  color: var(--muted);
  border-left: 3px solid var(--gold-dim);
  padding-left: 10px;
  line-height: 1.6;
}
.pc-grid, .act-grid, .gal-grid {
  display: grid;
  gap: 12px;
}
.pc-grid { grid-template-columns: 1fr; }
.pc-card, .act, .gal-item {
  background: #0c1412;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.pc-card img { width: 100%; height: 280px; object-fit: cover; object-position: top; }
.pc-card .meta, .act { padding: 12px; }
.pc-card h3 { color: var(--gold); }
.act { min-height: 92px; transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.act small { color: var(--muted); display: block; margin-top: 4px; }
.act:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--gold); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }
.act:active:not(:disabled) { transform: scale(0.97); }
.act:disabled { opacity: 0.45; cursor: not-allowed; }
.act-grid { animation: riseIn 0.35s ease both; }
.lock-badge {
  display: inline-block;
  font-size: 0.62rem;
  color: var(--gold-dim);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 1px 7px;
  margin-bottom: 5px;
  letter-spacing: 0.03em;
}
.act.lv-locked { border-style: dashed; opacity: 0.8; }
.act.lv-locked strong { color: var(--muted); }

.main {
  display: grid;
  gap: 14px;
}
.portrait-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 320px;
  background: #2a2218;
}
.portrait-wrap img { width: 100%; height: 56vh; object-fit: cover; object-position: top center; filter: brightness(1.18) contrast(1.06); }
.portrait-wrap img.swap { animation: fadeIn 0.6s ease; }
.hud {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 12px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.stat-list { display: grid; gap: 7px; }
.stat { display: grid; grid-template-columns: 72px 1fr 36px; gap: 8px; align-items: center; font-size: 0.8rem; }
.bar { height: 8px; background: #223; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--gold)); transition: width 0.5s ease; }
.bar.stress > i { background: linear-gradient(90deg, #8a3, var(--danger)); }

.log {
  max-height: 140px; overflow: auto;
  font-size: 0.85rem; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 8px;
}
.event-art { width: 100%; border-radius: 12px; max-height: 42vh; object-fit: cover; margin-bottom: 12px; }
.end-art { width: 100%; border-radius: 12px; max-height: 50vh; object-fit: cover; }

.gal-grid { grid-template-columns: 1fr 1fr; }
.gal-item img { height: 140px; width: 100%; object-fit: cover; filter: grayscale(0); }
.gal-item.locked img { filter: grayscale(1) brightness(0.25); }
.gal-item figcaption { padding: 8px; font-size: 0.78rem; color: var(--muted); }

.closet-grid { display: grid; gap: 12px; }
.closet-card {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  background: #0c1412;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.closet-card img { width: 110px; height: 140px; object-fit: cover; object-position: top; }
.closet-card .meta { padding: 10px 12px 12px 0; }
.closet-sec { color: var(--gold); font-size: 1.05rem; margin: 8px 0 0; grid-column: 1 / -1; }
.tone { font-size: 0.68rem; font-weight: 400; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; color: var(--muted); margin-left: 4px; }
.tone-modest { border-color: #6a7a6e; }
.tone-bold { border-color: #a56; color: #e0b8b8; }

.end-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.7;
}
.end-list strong { color: var(--ink); }

.menu-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.82rem;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.menu-btn:hover { color: var(--ink); transform: translateY(-1px); border-color: var(--gold-dim); }
.menu-btn.active { background: var(--green); border-color: #3d8a6e; color: var(--ink); }
.menu-btn .mi { color: var(--gold); font-size: 0.95rem; }
.menu-btn.active .mi { color: var(--ink); }

.advisor {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(201, 164, 90, 0.06);
}
.advisor-head { display: flex; align-items: center; gap: 10px; }
.advisor-avatar { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; }
.advisor-avatar img { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.55)); }
.advisor-head strong { color: var(--gold); font-family: var(--serif); font-size: 0.95rem; display: block; }
.advisor-head small { color: var(--muted); font-size: 0.72rem; display: block; }
.advisor-msg { margin: 2px 0 0; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 0.9rem; line-height: 1.6; }

.transition {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7, 11, 10, 0.84);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
}
.transition.run { opacity: 1; pointer-events: auto; transition: opacity 0.2s ease; }
.transition-inner {
  text-align: center;
  padding: 22px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: riseIn 0.5s ease both;
}
.transition-title { display: block; font-family: var(--serif); color: var(--gold); font-size: 1.6rem; letter-spacing: 0.02em; }
.transition-sub { display: block; margin-top: 6px; color: var(--muted); font-size: 0.9rem; max-width: 420px; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.advisor-avatar img { width: 100%; height: 100%; object-fit: contain; }

.counts { color: var(--muted); font-size: 0.75rem; white-space: nowrap; }

.share-wrap { position: relative; }
.share-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  min-width: 170px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  display: grid; gap: 4px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.share-item {
  display: block; width: 100%;
  text-align: left;
  border: none; background: transparent; color: var(--ink);
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 0.86rem;
}
.share-item:hover { background: rgba(201, 164, 90, 0.12); color: var(--gold); }

.board-list { display: grid; gap: 10px; }
.board-item {
  background: #0c1412;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.board-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.board-stars { color: var(--gold); letter-spacing: 0.08em; }
.board-name { color: var(--ink); font-family: var(--serif); }
.board-ending {
  display: inline-block; margin-top: 6px;
  font-size: 0.72rem; color: var(--gold);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px;
}
.board-comment { margin: 6px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.6; }
.board-date { display: block; margin-top: 6px; color: var(--gold-dim); font-size: 0.7rem; }

.rate {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: rgba(201, 164, 90, 0.05);
  display: grid; gap: 10px; margin-top: 4px;
}
.rate-ending-row { display: flex; align-items: center; gap: 8px; }
.rate-label { color: var(--muted); font-size: 0.8rem; }
.rate-ending { color: var(--gold); font-family: var(--serif); }
.stars { display: flex; gap: 4px; }
.star {
  border: none; background: transparent; cursor: pointer;
  color: #4a5149; font-size: 1.6rem; line-height: 1; padding: 0 2px;
  transition: transform 0.12s ease, color 0.12s ease;
}
.star:hover { transform: scale(1.15); }
.star.on { color: var(--gold); text-shadow: 0 0 12px rgba(201, 164, 90, 0.5); }
.rate-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  padding: 9px 11px;
  font-family: inherit; font-size: 0.9rem;
  resize: vertical;
}
.rate-input::placeholder { color: #6b766c; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 120;
  background: var(--panel-2);
  border: 1px solid var(--gold-dim);
  color: var(--ink);
  padding: 9px 16px; border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: riseIn 0.3s ease both;
}

@media (min-width: 860px) {
  .pc-grid { grid-template-columns: repeat(3, 1fr); }
  .pc-card img { height: 340px; }
  .act-grid { grid-template-columns: repeat(3, 1fr); }
  .main { grid-template-columns: 1.15fr 0.85fr; align-items: start; }
  .portrait-wrap img { height: min(72vh, 760px); }
  .gal-grid { grid-template-columns: repeat(4, 1fr); }
  .closet-grid { grid-template-columns: 1fr 1fr; }
}
