:root {
  --bg: #1a1625;
  --bg2: #2d2640;
  --card: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.1);
  --text: #f5f0ea;
  --muted: rgba(255,255,255,0.55);
  --gold: #c9a227;
  --pink: #e96e8a;
  --green: #6bcb8a;
  --radius: 14px;
  --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", sans-serif;
  background: linear-gradient(165deg, var(--bg) 0%, var(--bg2) 45%, var(--bg) 100%);
  color: var(--text);
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--gold); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.app-shell { min-height: 100%; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 8px); }
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: rgba(26,22,37,0.92);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar .back {
  border: none; background: rgba(255,255,255,0.08); color: var(--text);
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 18px;
}
.topbar h1 { flex: 1; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .lang-btn {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 6px 10px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.page { padding: 16px; max-width: 720px; margin: 0 auto; }
.hero { margin-bottom: 20px; }
.hero .badge {
  display: inline-block; font-size: 11px; color: var(--gold);
  border: 1px solid rgba(201,162,39,0.35); padding: 3px 10px; border-radius: 999px; margin-bottom: 10px;
}
.hero h2 { font-size: 24px; font-weight: 800; }
.hero p { font-size: 14px; color: var(--muted); margin-top: 8px; }
.section-label {
  font-size: 12px; color: var(--muted); letter-spacing: 0.06em;
  margin: 20px 0 10px; text-transform: uppercase;
}
.grid { display: grid; gap: 10px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  display: block; background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; color: inherit; text-decoration: none;
  transition: border-color .15s, transform .1s; cursor: pointer;
}
.card:active { transform: scale(0.98); }
.card:hover { border-color: rgba(201,162,39,0.35); }
.card-row { display: flex; align-items: flex-start; gap: 12px; }
.card .icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.card .title { font-size: 15px; font-weight: 700; }
.card .desc { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.tag {
  display: inline-block; font-size: 10px; color: var(--pink);
  background: rgba(233,110,138,0.15); padding: 2px 6px; border-radius: 6px; margin-left: 6px;
}
.tag.gold { color: var(--gold); background: rgba(201,162,39,0.15); }
.tabnav { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabnav button {
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--muted); padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.tabnav button.active { color: #f0d890; border-color: rgba(201,162,39,0.5); background: rgba(201,162,39,0.12); }
.quiz-progress {
  height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-bottom: 16px; overflow: hidden;
}
.quiz-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--pink)); transition: width .2s; }
.quiz-q { font-size: 17px; font-weight: 700; margin-bottom: 16px; line-height: 1.5; }
.quiz-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  border-radius: 12px; padding: 14px 16px; text-align: left; cursor: pointer; font-size: 14px;
}
.quiz-opt:hover { border-color: rgba(201,162,39,0.4); }
.quiz-opt.selected { border-color: var(--gold); background: rgba(201,162,39,0.12); }
.likert-row { display: flex; gap: 6px; flex-wrap: wrap; }
.likert-btn {
  flex: 1; min-width: 56px; border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  border-radius: 10px; padding: 10px 4px; font-size: 11px; cursor: pointer; text-align: center;
}
.likert-btn:hover { border-color: var(--pink); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; border: 1px solid var(--border); background: rgba(255,255,255,0.05);
  border-radius: 12px; padding: 12px 14px; outline: none;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; padding: 12px 18px; font-size: 15px; font-weight: 700;
  cursor: pointer; width: 100%;
}
.btn-primary { background: linear-gradient(90deg, var(--gold), #e8c96a); color: #2d2046; }
.btn-pink { background: linear-gradient(90deg, var(--pink), #ff9ec4); color: #fff; }
.btn-ghost { background: rgba(255,255,255,0.06); border: 1px solid var(--border); color: var(--text); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.result-hero { text-align: center; padding: 20px 12px; }
.result-hero .big { font-size: 42px; font-weight: 800; color: var(--gold); }
.result-hero .type-name { font-size: 20px; font-weight: 700; margin-top: 8px; }
.result-hero .summary { font-size: 14px; color: var(--muted); margin-top: 10px; line-height: 1.7; }
.dim-bars { margin-top: 16px; }
.dim-bar { margin-bottom: 12px; }
.dim-bar .lbl { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.dim-bar .track { height: 8px; background: rgba(255,255,255,0.08); border-radius: 4px; overflow: hidden; }
.dim-bar .fill { height: 100%; border-radius: 4px; transition: width .4s; }
.omikuji-box {
  text-align: center; padding: 32px 16px;
  background: radial-gradient(circle at 50% 30%, rgba(201,162,39,0.15), transparent 60%);
  border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px;
}
.omikuji-tube { font-size: 64px; cursor: pointer; user-select: none; transition: transform .15s; display: inline-block; }
.omikuji-tube.shake { animation: shake .5s ease; }
@keyframes shake {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); }
  80% { transform: rotate(5deg); }
}
.draw-card {
  background: linear-gradient(145deg, rgba(201,162,39,0.12), rgba(233,110,138,0.08));
  border: 1px solid rgba(201,162,39,0.3); border-radius: var(--radius); padding: 20px; margin-top: 16px;
}
.draw-card .tier { font-size: 12px; color: var(--gold); font-weight: 700; }
.draw-card .title { font-size: 20px; font-weight: 800; margin: 8px 0; }
.draw-card .poem { font-size: 14px; line-height: 1.8; color: var(--muted); font-style: italic; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; font-size: 12px; }
.cal-grid .hd { color: var(--muted); padding: 6px 0; font-weight: 700; }
.cal-grid .day {
  padding: 8px 0; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
}
.cal-grid .day.today { border-color: var(--gold); background: rgba(201,162,39,0.12); color: var(--gold); font-weight: 700; }
.cal-grid .day.other { color: rgba(255,255,255,0.25); }
.journal-list { display: flex; flex-direction: column; gap: 10px; }
.journal-item {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
}
.journal-item .date { font-size: 11px; color: var(--muted); }
.journal-item .text { font-size: 14px; margin-top: 6px; white-space: pre-wrap; }
.journal-item .acts { margin-top: 8px; display: flex; gap: 8px; }
.journal-item .acts button {
  border: 1px solid var(--border); background: transparent; color: var(--muted);
  padding: 4px 10px; border-radius: 8px; font-size: 11px; cursor: pointer;
}
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; background: rgba(22,18,32,0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border); padding-bottom: var(--safe-b);
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 8px 4px 10px; color: var(--muted);
  text-decoration: none; font-size: 10px;
}
.bottom-nav a .ic { display: block; font-size: 22px; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--gold); }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px); transform: translateX(-50%);
  background: rgba(0,0,0,0.85); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.loading { text-align: center; padding: 40px; color: var(--muted); font-size: 14px; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.notice {
  padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.6;
  background: rgba(201,162,39,0.1); border: 1px solid rgba(201,162,39,0.25); color: #f0d890; margin-bottom: 14px;
}
.profile-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px;
}
.profile-card .avatar {
  width: 52px; height: 52px; border-radius: 50%; background: rgba(201,162,39,0.2);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.profile-card .nick { font-size: 16px; font-weight: 700; }
.profile-card .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
@media (min-width: 768px) {
  .bottom-nav { max-width: 720px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}
