:root {
  --bg: #0f1419;
  --panel: #1a2028;
  --panel-2: #232b36;
  --border: #2d3744;
  --text: #e6edf3;
  --text-dim: #8b96a3;
  --gold: #d4a017;
  --green: #4ade80;
  --red: #ef4444;
  --orange: #f59e0b;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

#root {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 14px 80px;
}

h1, h2, h3 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 20px; }
h2 { font-size: 17px; color: var(--gold); }
h3 { font-size: 15px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

p { margin: 0 0 8px; }

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin: 6px 0 0;
  line-height: 1.35;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.5px;
  color: var(--gold);
}

.icon-btn {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.week-banner {
  background: linear-gradient(180deg, #2a1f0a 0%, #1f1808 100%);
  border: 1px solid #5c4313;
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 14px;
}
.week-banner b { color: var(--gold); }
.week-banner.compact { padding: 8px 10px; font-size: 13px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 6px;
  font-weight: 500;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 12px;
  font-size: 16px;
  font-family: inherit;
  min-height: 48px;
}

textarea {
  resize: vertical;
  min-height: 84px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
}

.field { margin-bottom: 12px; }

.row3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.row3 input { padding: 10px 8px; font-size: 15px; }
.row3 label { font-size: 12px; }

.btn {
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  min-height: 56px;
  font-family: inherit;
}

.btn-primary {
  background: var(--green);
  color: #062712;
}
.btn-primary:disabled {
  background: #2a3a32;
  color: #5d6b62;
  cursor: not-allowed;
}

.btn-gold {
  background: var(--gold);
  color: #1a1206;
}
.btn-gold:disabled {
  background: #3a2f10;
  color: #6a5d3a;
  cursor: not-allowed;
}

.btn-secondary {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--red);
  color: #2a0a0a;
}

.btn-mini {
  display: inline-block;
  width: auto;
  padding: 8px 14px;
  font-size: 14px;
  min-height: 40px;
}

.link {
  background: none;
  border: none;
  color: var(--text-dim);
  text-decoration: underline;
  cursor: pointer;
  font-size: 13px;
  padding: 8px;
  font-family: inherit;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 44px;
  font-weight: 700;
  color: var(--green);
  text-align: center;
  margin: 6px 0 4px;
  letter-spacing: 1px;
}

.timer-label {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 14px;
}

.readonly-card {
  background: var(--panel-2);
  border-left: 3px solid var(--gold);
}
.readonly-card .ro-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  font-size: 14px;
  border-bottom: 1px dashed var(--border);
}
.readonly-card .ro-row:last-child { border-bottom: none; }
.readonly-card .ro-row .k { color: var(--text-dim); flex-shrink: 0; }
.readonly-card .ro-row .v { color: var(--text); text-align: right; word-break: break-word; }

.sub-list { margin: 8px 0 12px; }
.sub-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}
.sub-row .t { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sub-row .a { color: var(--gold); font-weight: 600; }
.sub-row .e { font-weight: 700; font-variant-numeric: tabular-nums; }
.sub-row .e.pos { color: var(--green); }
.sub-row .e.neg { color: var(--red); }
.sub-row .n { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; padding-top: 2px; }

.radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.radio-group label {
  flex: 1;
  min-width: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  margin: 0;
}
.radio-group label.checked {
  background: var(--gold);
  color: #1a1206;
  border-color: var(--gold);
  font-weight: 600;
}
.radio-group input { display: none; }

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  font-size: 14px;
}
.summary-grid .k { color: var(--text-dim); }
.summary-grid .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.muted { color: var(--text-dim); font-size: 13px; }
.center { text-align: center; }
.spacer { height: 10px; }

.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
  padding: 18px 16px 28px;
  max-height: 85vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.sheet .sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.sheet h2 { margin: 0; }

.rule-list {
  font-size: 13px;
  color: var(--text-dim);
  background: var(--bg);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.rule-list li { margin-bottom: 4px; }

.inline-form {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 10px;
  margin: 8px 0;
}

.warn {
  background: #2a1a0a;
  border: 1px solid #6b3d0a;
  color: var(--orange);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}

.footer-version {
  text-align: center;
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 24px;
  letter-spacing: 0.5px;
}
