:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#app { width: 100%; height: 100%; position: relative; }

.screen {
  width: 100%; height: 100%; position: absolute; top: 0; left: 0;
  display: flex; flex-direction: column;
}
.screen.hidden { display: none; }
.hidden { display: none !important; }

.focusable {
  transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  border: 2px solid transparent; cursor: pointer; outline: none;
}
.focusable:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 20px var(--focus-glow);
  background: var(--bg-tertiary);
}

/* ---- Bars / headers ---- */
.bar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--bg-primary);
  border-bottom: 1px solid #23232f;
}
.bar-home { flex-direction: column; align-items: flex-start; gap: 4px; padding: 22px 24px 16px; }
.app-title { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
.app-sub { font-size: 17px; color: var(--text-secondary); }
.bar-title { font-size: 26px; font-weight: 700; }

.back-btn {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; line-height: 1;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  font-weight: 700;
}

/* ---- Value editor ---- */
.value-row {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px 8px;
}
.step-btn {
  flex: 0 0 auto;
  width: 88px; height: 88px;
  display: flex; align-items: center; justify-content: center;
  font-size: 50px; font-weight: 700; line-height: 1;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 16px;
}
.value-box {
  flex: 1 1 auto; min-width: 0;
  height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--bg-secondary);
  border: 2px solid #23232f;
  border-radius: 16px;
}
.value-num {
  font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1;
  font-variant-numeric: tabular-nums;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.value-unit { font-size: 19px; font-weight: 600; color: var(--accent); margin-top: 5px; }

/* ---- Control chips ---- */
.chips {
  flex: 0 0 auto;
  display: flex; gap: 12px;
  padding: 4px 20px 8px;
}
.chip {
  flex: 1 1 0; min-width: 0;
  height: 78px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 14px;
}
.chip-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.chip-val { font-size: 25px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-sub { font-size: 12px; color: var(--text-secondary); }

/* ---- Results ---- */
.results {
  flex: 1 1 auto; overflow-y: auto;
  padding: 6px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.results::-webkit-scrollbar { width: 6px; }
.results::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 3px; }
.res-row {
  flex: 0 0 auto;
  min-height: 48px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-radius: 12px;
  border-left: 4px solid transparent;
}
.res-row.active { border-left-color: var(--accent); background: var(--bg-tertiary); }
.res-label { flex: 0 0 auto; width: 56px; font-size: 22px; font-weight: 700; color: var(--text-secondary); }
.res-row.active .res-label { color: var(--accent); }
.res-val {
  flex: 1 1 auto; text-align: right;
  font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---- Actions ---- */
.actions {
  flex: 0 0 auto;
  display: flex; gap: 12px;
  padding: 6px 20px 8px;
}
.mini-btn {
  flex: 1 1 0;
  height: 62px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 600;
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: var(--radius-md);
}

/* ---- Guide ---- */
.guide {
  flex: 1 1 auto; overflow-y: auto;
  padding: 18px 22px;
  display: flex; flex-direction: column; gap: 11px;
}
.guide::-webkit-scrollbar { width: 6px; }
.guide::-webkit-scrollbar-thumb { background: #2a2a3a; border-radius: 3px; }
.g-h { font-size: 21px; font-weight: 700; color: var(--accent); margin-top: 4px; }
.g-p { font-size: 18px; line-height: 1.45; color: var(--text-secondary); }
.g-p b { color: var(--text-primary); }
.g-table { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.g-row {
  display: flex; gap: 10px;
  background: var(--bg-secondary);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 16px; font-variant-numeric: tabular-nums;
}
.g-row.head { background: var(--bg-tertiary); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.g-cell { flex: 1 1 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.g-cell:first-child { flex: 0 0 44px; font-weight: 700; color: var(--text-primary); }
.g-note { font-size: 16px; line-height: 1.45; color: var(--text-muted); margin-top: 4px; }
.g-note b { color: var(--text-secondary); }

/* ---- Footer hint ---- */
.hint {
  flex: 0 0 auto;
  padding: 6px 20px 12px;
  font-size: 15px; color: var(--text-muted); text-align: center;
}
