/* ============ Handy Calculators ============ */

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

:root {
  --ink: #1e293b;
  --muted: #64748b;
  --card: #ffffff;
  --line: #e2e8f0;
  --blue: #3b82f6;
  --green: #10b981;
  --orange: #f59e0b;
  --purple: #8b5cf6;
  --radius: 22px;
}

html { font-size: 17px; }

body {
  font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 600;
  color: var(--ink);
  background: linear-gradient(160deg, #dbeafe 0%, #ede9fe 55%, #fce7f3 100%) fixed;
  min-height: 100vh;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 28px 16px 40px; }

/* ---------- header ---------- */
.site-header { text-align: center; margin-bottom: 22px; position: relative; }

#menuBtn {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1.45rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(30, 41, 59, 0.1);
  transition: transform 0.12s ease;
}
#menuBtn:hover { transform: scale(1.06); }

.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 100;
}
.menu-overlay.open { display: block; }
.menu-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(360px, calc(100vw - 32px));
  max-height: 85vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  animation: pop 0.18s ease;
}
.menu-head { font-weight: 900; font-size: 1.05rem; padding: 8px 12px 10px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 14px;
  background: transparent;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: #f1f5f9; }
.menu-item.active { background: #fff1f2; color: #e11d48; }
.mi-emoji { font-size: 1.5rem; }
.mi-desc { display: block; font-size: 0.83rem; font-weight: 700; color: var(--muted); }
.site-header h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); font-weight: 900; letter-spacing: -0.5px; }
.brand-cherry { color: #e11d48; }
.tagline { color: var(--muted); font-size: 1.1rem; font-weight: 700; margin-top: 2px; }
.perks { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }

/* ---------- tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}
.tab {
  --tc: var(--blue);
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--muted);
  background: var(--card);
  border: 3px solid transparent;
  border-radius: 18px;
  padding: 12px 6px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(30, 41, 59, 0.08);
  transition: transform 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.tab:hover { transform: translateY(-2px); }
.tab.is-active { border-color: var(--tc); color: var(--tc); transform: translateY(-2px); }
@media (max-width: 760px) {
  .tabs { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 480px) {
  .tabs { grid-template-columns: repeat(2, 1fr); }
  .tabs .tab:last-child:nth-child(odd) { grid-column: span 2; }
}

/* ---------- panels & cards ---------- */
.panel { display: none; }
.panel.is-active { display: block; animation: pop 0.25s ease; }
@keyframes pop {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 10px 30px rgba(30, 41, 59, 0.08);
  margin-top: 18px;
}
.card h2 { font-size: 1.3rem; font-weight: 900; }
.sub { color: var(--muted); margin: 4px 0 18px; }
.hint { color: var(--muted); font-size: 0.9rem; margin-top: 14px; text-align: center; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }

/* ---------- calculator ---------- */
.calc-card { max-width: 460px; margin-left: auto; margin-right: auto; }
.calc { max-width: 380px; margin: 0 auto; }

.calc-screen {
  background: #0f172a;
  border-radius: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  text-align: right;
  overflow: hidden;
}
.calc-history { color: #94a3b8; font-size: 0.95rem; min-height: 1.3em; font-weight: 700; }
.calc-display {
  color: #f8fafc;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.2;
  word-break: break-all;
}
.calc-display.small { font-size: 1.5rem; }

.calc-keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.calc-keys button {
  font-family: inherit;
  font-size: 1.35rem;
  font-weight: 800;
  height: 60px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.12s ease;
}
.calc-keys button:hover { filter: brightness(0.95); }
.calc-keys button:active { transform: scale(0.93); }
.k-num { background: #f1f5f9; color: var(--ink); }
.k-fn { background: #e2e8f0; color: #475569; }
.k-danger { background: #fee2e2; color: #b91c1c; }
.k-op { background: #dbeafe; color: #1d4ed8; font-size: 1.5rem; }
.k-eq { background: var(--blue); color: #fff; font-size: 1.5rem; }
.k-zero { grid-column: span 2; }

/* ---------- inputs ---------- */
select, input[type="number"], input[type="time"], input[type="date"] {
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
select:focus, input:focus { outline: none; border-color: var(--blue); }
:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

input[type="number"] { width: 130px; }
input[type="range"] { flex: 1; height: 34px; accent-color: var(--orange); cursor: pointer; }

.big-select { width: 100%; font-size: 1.15rem; padding: 13px 14px; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.field { margin-bottom: 18px; }
.lrow { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.lrow label { font-weight: 800; }
.lrow small { color: var(--muted); font-weight: 700; }
.unit { color: var(--muted); font-weight: 800; }

.chip {
  background: #f1f5f9;
  border-radius: 999px;
  padding: 3px 12px;
  font-weight: 800;
  font-size: 0.9rem;
  color: #475569;
  white-space: nowrap;
}

/* ---------- pills & chips ---------- */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 999px;
  border: 2px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.12s ease;
}
.pill:hover { border-color: #cbd5e1; }
.pill.is-active { background: var(--orange); border-color: var(--orange); color: #fff; }
.pill.purple.is-active { background: var(--purple); border-color: var(--purple); }
.pill.small { font-size: 0.9rem; padding: 8px 14px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.chipbtn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 7px 13px;
  border-radius: 999px;
  border: 2px solid #ede9fe;
  background: #f5f3ff;
  color: #6d28d9;
  cursor: pointer;
}
.chipbtn:hover { background: #ede9fe; }

/* ---------- USA time zone map ---------- */
#usMap svg { width: 100%; height: auto; display: block; }
#usMap .tz-pacific  { fill: #7dd3fc; }
#usMap .tz-mountain { fill: #fcd34d; }
#usMap .tz-central  { fill: #86efac; }
#usMap .tz-eastern  { fill: #fda4af; }
#usMap .tz-alaska   { fill: #c4b5fd; }
#usMap .tz-hawaii   { fill: #f9a8d4; }
#usMap .tz-pacific:hover, #usMap .tz-mountain:hover, #usMap .tz-central:hover,
#usMap .tz-eastern:hover, #usMap .tz-alaska:hover, #usMap .tz-hawaii:hover {
  filter: brightness(0.92);
}
#usMap .map-badge { filter: drop-shadow(0 2px 5px rgba(15, 23, 42, 0.25)); pointer-events: none; }
#usMap .map-badge rect { fill: rgba(255, 255, 255, 0.93); stroke: rgba(15, 23, 42, 0.1); }
#usMap .mb-name { font-family: 'Nunito', system-ui, sans-serif; font-size: 11px; font-weight: 800; fill: #64748b; letter-spacing: 1px; }
#usMap .mb-time { font-family: 'Nunito', system-ui, sans-serif; font-size: 19px; font-weight: 900; fill: #0f172a; }

.tzlegend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tzchip {
  background: #f8fafc;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 800;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 7px;
}
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot-pacific  { background: #7dd3fc; }
.dot-mountain { background: #fcd34d; }
.dot-central  { background: #86efac; }
.dot-eastern  { background: #fda4af; }
.dot-alaska   { background: #c4b5fd; }
.dot-hawaii   { background: #f9a8d4; }

/* ---------- time zones ---------- */
.zone-clock { text-align: center; padding: 18px 0 8px; }
.bigtime { font-size: clamp(2.4rem, 8vw, 3.6rem); font-weight: 900; letter-spacing: -1px; }
.bigtime.green { color: #059669; }
.bigtime.purple { color: #7c3aed; }
.zone-date { color: var(--muted); font-size: 1.05rem; font-weight: 700; margin: 2px 0 10px; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 800;
  font-size: 0.95rem;
}
.b-ahead { background: #dcfce7; color: #166534; }
.b-behind { background: #fef3c7; color: #92400e; }
.b-same { background: #dbeafe; color: #1e40af; }

.yourline { text-align: center; color: var(--muted); margin-top: 10px; font-size: 0.95rem; }
.yourline b { color: var(--ink); }

.conv-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 800; }
.conv-out { font-size: 1.35rem; font-weight: 800; margin-top: 16px; background: #ecfdf5; border-radius: 14px; padding: 14px 16px; }
.conv-out b { color: #059669; font-size: 1.5rem; }

.wg { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 10px; }
.wc { background: #f8fafc; border-radius: 14px; padding: 12px; text-align: center; }
.wc .c { color: var(--muted); font-size: 0.9rem; font-weight: 800; }
.wc .t { font-weight: 900; font-size: 1.2rem; margin-top: 2px; }

/* ---------- loan ---------- */
.money-big { font-size: clamp(2.2rem, 7vw, 3rem); font-weight: 900; color: #d97706; text-align: center; }
.money-cap { text-align: center; color: var(--muted); font-weight: 800; margin-bottom: 14px; }
.cheer { text-align: center; background: #dcfce7; color: #166534; border-radius: 12px; padding: 10px 12px; font-weight: 800; margin-bottom: 12px; }

.breakdown { margin-top: 8px; }
.brow {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 2px dashed var(--line);
  color: var(--muted);
  font-weight: 700;
}
.brow b { color: var(--ink); }

.note { background: #fef3c7; border-radius: 12px; padding: 11px 13px; font-size: 0.92rem; margin-top: 16px; }

/* ---------- time math ---------- */
.hero-card { border: 3px solid var(--purple); position: relative; }
.herotag {
  position: absolute;
  top: -15px;
  left: 20px;
  background: var(--purple);
  color: #fff;
  border-radius: 999px;
  padding: 4px 14px;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.35);
}
.t-date { font-size: 1.3rem; font-weight: 800; color: var(--ink); margin-top: 2px; }

.t-result { text-align: center; margin-top: 18px; background: #faf5ff; border-radius: 16px; padding: 16px; }
.daynote { font-weight: 800; color: #7c3aed; min-height: 1.4em; margin-top: 2px; }
.sentence { color: var(--muted); font-weight: 700; margin-top: 6px; }
.dur-big { font-size: clamp(1.6rem, 5vw, 2.2rem); font-weight: 900; color: #7c3aed; }

/* ---------- timers ---------- */
.timer-display {
  font-size: clamp(2.8rem, 9vw, 4.2rem);
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: #0f172a;
  margin: 8px 0;
}
.timer-display.done { color: #e11d48; animation: tflash 0.5s ease 4; }
@keyframes tflash {
  50% { opacity: 0.25; }
}
.trow { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tbtn {
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 900;
  padding: 14px 26px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.12s ease;
}
.tbtn:hover { filter: brightness(0.95); }
.tbtn:active { transform: scale(0.95); }
.tbtn.go { background: #10b981; color: #fff; }
.tbtn.go.running { background: #f59e0b; }
.tbtn.blue { background: #dbeafe; color: #1d4ed8; }
.tbtn.gray { background: #e2e8f0; color: #334155; }
.row.center { justify-content: center; }
.row.center input[type="number"] { width: 90px; }
.cd-sliderwrap { margin: 14px 4px 4px; }
.cd-range { width: 100%; height: 40px; accent-color: #e11d48; cursor: pointer; }
.cd-scale {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}
.cd-scale b { color: #e11d48; font-size: 1.05rem; font-weight: 900; }
.tcenter { text-align: center; }
.laps { list-style: none; margin-top: 12px; max-height: 150px; overflow: auto; text-align: center; font-weight: 800; color: #475569; }
.laps li { padding: 5px 0; border-bottom: 2px dashed var(--line); }
.pomo-status { text-align: center; font-size: 1.35rem; font-weight: 900; margin: 8px 0 0; }
.pomo-dots { text-align: center; font-size: 1.35rem; letter-spacing: 6px; margin: 2px 0 10px; }

/* ---------- footer ---------- */
footer { text-align: center; color: var(--muted); font-size: 0.9rem; margin-top: 30px; }
