/* Шоколадная фабрика — тёплый шоколадный UI */
:root {
  --bg: #1a120c;
  --bg2: #24180f;
  --card: #2c1d14;
  --card2: #3a271b;
  --ink: #f6e8d7;
  --muted: #c9a98a;
  --accent: #c47a3a;
  --accent2: #e0a15a;
  --good: #7cbc6e;
  --danger: #d36b5e;
  --line: rgba(244, 214, 180, 0.12);
  --radius: 16px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 10% -10%, #4a2a16 0%, transparent 55%),
    radial-gradient(800px 400px at 100% 0%, #3a1f12 0%, transparent 50%),
    var(--bg);
}

#app { max-width: 480px; margin: 0 auto; padding: 16px 16px 48px; }

.top { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.logo {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(145deg, #8b4d24, #3a1f12);
  display: grid; place-items: center; font-size: 28px;
  box-shadow: var(--shadow);
}
h1 { margin: 0; font-size: 1.15rem; letter-spacing: .2px; }
.sub { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }

.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
  background: var(--bg2); padding: 6px; border-radius: 14px; margin-bottom: 14px;
  border: 1px solid var(--line);
}
.tab {
  border: 0; background: transparent; color: var(--muted);
  padding: 10px 8px; border-radius: 10px; font-weight: 600; cursor: pointer;
}
.tab.active { background: var(--card2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }

.panel { display: none; animation: fade .2s ease; }
.panel.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none; } }

.card {
  background: linear-gradient(180deg, var(--card) 0%, #23170f 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin: 0 0 8px; font-size: 1.05rem; }
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 12px; }
.hint.quiet { opacity: .8; margin-top: 6px; }
.hint em { font-style: normal; opacity: .7; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 8px; font-size: .9rem; color: var(--muted); }

.stepper {
  display: grid; grid-template-columns: 48px 1fr 48px; gap: 8px; align-items: center;
}
.stepper button, .volume button, .period-tabs button, .btn {
  font: inherit; cursor: pointer; border: 0;
}
.stepper button {
  height: 44px; border-radius: 12px; background: var(--card2); color: var(--ink);
  font-size: 1.3rem; border: 1px solid var(--line);
}
.stepper input, #duration {
  width: 100%; height: 44px; border-radius: 12px;
  background: #1a110c; color: var(--ink); border: 1px solid var(--line);
  text-align: center; font-size: 1.1rem; font-weight: 600;
}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.volume { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.volume button {
  height: 44px; border-radius: 12px; background: var(--card2); color: var(--muted);
  border: 1px solid var(--line); font-weight: 700;
}
.volume button.on {
  background: linear-gradient(145deg, var(--accent2), var(--accent));
  color: #1a1008; border-color: transparent;
}

.btn {
  width: 100%; height: 48px; border-radius: 14px; font-weight: 700; margin-top: 6px;
}
.btn.primary {
  background: linear-gradient(145deg, #e0a15a, #b56a2e);
  color: #1a1008;
}
.btn.primary:active { transform: scale(.98); }
.btn.ghost {
  background: transparent; color: var(--muted); border: 1px dashed var(--line); height: 40px; margin-top: 10px;
}
.status { min-height: 1.2em; margin: 10px 0 0; font-size: .9rem; color: var(--good); }
.status.err { color: var(--danger); }

.title-card { text-align: center; padding: 24px 16px; }
.title-emoji { font-size: 3rem; line-height: 1; margin-bottom: 6px; }
.title-card h2 { font-size: 1.35rem; }

.stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px;
  background: transparent; border: 0; box-shadow: none;
}
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
}
.stat .n { font-size: 1.35rem; font-weight: 800; }
.stat .l { color: var(--muted); font-size: .75rem; margin-top: 2px; }

.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  background: var(--card2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 10px; font-size: .8rem; color: var(--ink);
}

.period-tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px;
}
.period-tabs button {
  height: 36px; border-radius: 10px; background: var(--bg2); color: var(--muted);
  border: 1px solid var(--line); font-weight: 600; font-size: .85rem;
}
.period-tabs button.on {
  background: var(--card2); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list .r { font-weight: 800; color: var(--accent2); }
.rank-list .name { font-weight: 600; }
.rank-list .meta { color: var(--muted); font-size: .75rem; }
.rank-list .score { font-weight: 800; }
.rank-list li.me { background: rgba(196, 122, 58, .12); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }

#rank-me { font-size: .95rem; }
#rank-me strong { color: var(--accent2); }

.foot {
  margin-top: 20px; text-align: center; color: var(--muted); font-size: .7rem; opacity: .7;
}
