:root {
  --bg: #000000;
  --card: #141517;
  --card-2: #232427;
  --card-3: #2E2F33;
  --inset: #0C0D0E;
  --text: #F5F5F3;
  --text-2: #C9CACD;
  --muted: #A3A5AA;
  --accent: #C8F135;
  --accent-ink: #0B0B0C;
  --up: #4ADE80;
  --down: #F87171;
  --danger-bg: #3A1C1E;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
#root { min-height: 100dvh; display: flex; justify-content: center; }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; background: transparent; transition: transform .12s ease, background-color .15s ease, color .15s ease; }
button:disabled { cursor: default; }
button:active:not(:disabled) { transform: scale(.96); }
input { font-family: inherit; }
input::placeholder { color: #6F7176; }
input[type=text]:focus, input[type=email]:focus { outline: none; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }
a { color: var(--accent); }

.app { width: 100%; max-width: 480px; min-height: 100dvh; position: relative; display: flex; flex-direction: column; }
.topbar { height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font-size: 17px; font-weight: 800; letter-spacing: -0.01em; }
.brand span { color: var(--accent); }
.account { min-height: 40px; padding: 0 12px; font-size: 14px; font-weight: 700; color: var(--text-2); background: var(--card); border-radius: 12px; }

.screen { flex: 1; padding: 8px 20px 120px; display: flex; flex-direction: column; gap: 20px; animation: screenin .2s ease-out; }
.center { flex: 1; padding: 40px 24px; display: flex; flex-direction: column; justify-content: center; gap: 12px; }
.center h1 { margin: 0; font-size: 28px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.center p { margin: 0; font-size: 15px; line-height: 1.45; color: var(--muted); }

.icon-btn { width: 44px; height: 44px; margin-left: -10px; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.icon-btn svg, .trash svg, .x svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.title { margin: 0; font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; }
.h2 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text-2); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.tile { width: 100%; min-height: 66px; padding: 10px 16px; display: flex; flex-direction: column; justify-content: center; gap: 3px; text-align: left; background: var(--card); border-radius: 16px; }
.tile:active, .soft:active { background: var(--card-3) !important; }
.tile .name { font-size: 17px; font-weight: 700; }
.tile .status { font-size: 13px; font-weight: 600; color: var(--muted); }
.tile .status.on { color: var(--accent); }
.group-tile { min-height: 72px; padding: 8px 14px; text-align: left; font-size: 17px; font-weight: 700; background: var(--card); border-radius: 16px; }

.plus-link { min-height: 48px; align-self: flex-start; padding: 0 12px 0 0; display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; border-radius: 10px; }
.plus-box { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; font-size: 18px; line-height: 1; font-weight: 700; border: 1px solid #8E9096; border-radius: 5px; }

.panel { padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card); border-radius: 16px; }
.label { font-size: 14px; font-weight: 700; color: var(--text-2); }
.field { width: 100%; height: 52px; padding: 0 14px; font-size: 17px; font-weight: 600; color: var(--text); background: var(--bg); border: 0; border-radius: 12px; }
.suggest { min-height: 44px; padding: 6px 12px; text-align: left; font-size: 15px; font-weight: 600; background: var(--card-2); border-radius: 10px; }

.primary { width: 100%; height: 56px; font-size: 17px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 16px; }
.primary:disabled { background: #26272A; color: var(--muted); }
.secondary { width: 100%; height: 48px; font-size: 16px; font-weight: 700; background: var(--card-2); border-radius: 14px; }
.ghost { width: 100%; height: 44px; font-size: 15px; font-weight: 700; border-radius: 12px; }

.log-head { display: flex; flex-direction: column; gap: 4px; }
.log-ex { font-size: 18px; font-weight: 800; color: var(--accent); }
.log-date { margin: 0; font-size: 38px; line-height: 1.1; font-weight: 800; letter-spacing: -0.025em; }
.log-week { font-size: 15px; font-weight: 500; color: var(--muted); }
.hint { margin: 0 0 2px; font-size: 13px; font-weight: 500; color: var(--muted); }

.set-row { min-height: 60px; padding: 6px 6px 6px 14px; display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; animation: rowin .24s ease-out; }
.set-row.editing { background: #26291A; }
.set-main { flex: 1; min-width: 0; min-height: 48px; padding: 4px 0; display: flex; align-items: center; gap: 12px; text-align: left; border-radius: 10px; }
.ord { width: 30px; flex-shrink: 0; font-size: 14px; font-weight: 700; color: var(--muted); }
.set-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.set-sum { font-size: 16px; font-weight: 700; }
.set-drops { font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--text-2); white-space: pre-line; }
.set-rating { font-size: 13px; line-height: 1.35; font-weight: 700; }
.trash { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--text-2); border-radius: 12px; }

.form { padding: 18px; display: flex; flex-direction: column; gap: 14px; background: var(--card); border-radius: 24px; animation: rowin .24s ease-out; }
.form-title { margin: 0; font-size: 26px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.editing-tag { font-size: 14px; font-weight: 700; color: var(--accent); }
.prev { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prev-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.prev-val { font-size: 15px; font-weight: 700; }
.same { min-height: 44px; padding: 0 14px; flex-shrink: 0; font-size: 14px; font-weight: 700; color: var(--accent); background: var(--card-2); border-radius: 12px; }

.stepper-label { text-align: center; font-size: 14px; font-weight: 700; color: var(--text-2); }
.stepper { height: 68px; padding: 6px; display: flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 18px; }
.stepper button { width: 56px; height: 56px; flex-shrink: 0; font-size: 26px; font-weight: 700; background: var(--card-2); border-radius: 14px; }
.stepper .minus { color: var(--down); }
.stepper .plus { color: var(--up); }
.stepper input { flex: 1; width: 100%; height: 56px; min-width: 0; padding: 0 4px; text-align: center; font-size: 34px; font-weight: 800; color: var(--text); background: var(--card); border: 0; border-radius: 14px; }
.stepper.small { height: 60px; padding: 5px; gap: 5px; border-radius: 16px; }
.stepper.small button { width: 50px; height: 50px; font-size: 24px; border-radius: 12px; }
.stepper.small input { height: 50px; font-size: 30px; border-radius: 12px; }

.check { min-height: 44px; display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 700; cursor: pointer; }
.check.small { align-items: flex-start; font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--text-2); }
.check.small input { margin-top: 1px; }

.drop { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--inset); border-radius: 18px; animation: rowin .24s ease-out; }
.drop-head { min-height: 44px; padding-left: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.drop-head h3 { margin: 0; font-size: 20px; line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.x { width: 44px; height: 44px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--down); background: var(--danger-bg); border-radius: 12px; }

.ratings { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.ratings button { min-height: 58px; min-width: 0; padding: 4px 1px; font-size: 11px; letter-spacing: -0.01em; overflow-wrap: anywhere; line-height: 1.2; font-weight: 700; text-align: center; border: 2px solid; border-radius: 12px; }

.next-set { width: 100%; height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 19px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 18px; }

.banner { padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #1A1C12; border: 1px solid #3B4416; border-radius: 16px; font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--text-2); }
.banner button { align-self: flex-start; min-height: 44px; padding: 0 16px; font-size: 15px; font-weight: 800; color: var(--accent-ink); background: var(--accent); border-radius: 12px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; width: calc(100% - 32px); max-width: 448px; min-height: 56px; padding: 6px 6px 6px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--text); color: var(--accent-ink); border-radius: 16px; animation: toastin .2s ease-out; z-index: 20; }
.toast .t1 { font-size: 15px; font-weight: 700; }
.toast .t2 { font-size: 13px; font-weight: 700; color: #166534; }
.toast.error { background: #FECACA; }
.toast button { min-height: 44px; padding: 0 14px; flex-shrink: 0; font-size: 15px; font-weight: 800; color: var(--text); background: var(--accent-ink); border-radius: 12px; }

.overlay { position: fixed; inset: 0; padding: 16px; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.72); z-index: 30; }
.sheet { width: 100%; max-width: 448px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; background: #1B1C1F; border-radius: 24px; animation: toastin .2s ease-out; }
.sheet h2 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 800; letter-spacing: -0.02em; }
.sheet p { margin: 0; font-size: 15px; line-height: 1.4; font-weight: 600; color: var(--text-2); }
.sheet .error { font-size: 14px; font-weight: 700; color: var(--down); }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.danger { height: 54px; font-size: 16px; font-weight: 800; color: var(--accent-ink); background: var(--down); border-radius: 14px; }
.code-field { letter-spacing: 0.3em; text-align: center; font-size: 26px; font-weight: 800; }

@keyframes screenin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rowin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.sheet { animation-name: sheetin; }
@keyframes sheetin { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen, .set-row, .form, .drop, .toast, .sheet { animation: none; }
  button { transition: none; }
  button:active:not(:disabled) { transform: none; }
}
