/* KPOT cook timer — dark, high-contrast, built for a dim table and greasy thumbs. */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:root {
  --bg: #0f1d19;
  --panel: #16281f;
  --card: #1b3128;
  --card-hi: #244135;
  --line: #2c4a3d;
  --ink: #f5efe2;
  --sub: #9db4a8;
  --red: #ff5347;
  --red-deep: #c92a20;
  --amber: #ffb020;
  --green: #4cd07d;
  --cream: #f3e9d2;
}

html { font-size: 16px; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  padding-bottom: 60px;
  overscroll-behavior-y: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

/* ---------------- header ---------------- */
header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 8px;
  max-width: 1100px;
  margin: 0 auto;
}

h1 {
  font-size: 22px;
  letter-spacing: 0.5px;
  font-weight: 800;
}
h1 .k { color: var(--red); }

#sound-pill {
  margin-left: auto;
  font-size: 12px;
  color: var(--bg);
  background: var(--amber);
  font-weight: 700;
  border-radius: 99px;
  padding: 5px 10px;
  animation: nudge 2s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: scale(1.06); } }

.disclaimer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 14px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--sub);
}
.disclaimer b { color: var(--amber); font-weight: 700; }

/* ---------------- timer tray ---------------- */
#tray-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 10px 6px;
}

#tray-wrap.empty #tray { display: none; }
#tray-wrap .tray-hint { display: none; }
#tray-wrap.empty .tray-hint {
  display: block;
  border: 2px dashed var(--line);
  border-radius: 14px;
  color: var(--sub);
  text-align: center;
  padding: 18px 12px;
  font-size: 15px;
}

#tray {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 8px;
}

.tcard {
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tmain { display: flex; align-items: center; gap: 8px; min-height: 68px; }

.ring { position: relative; width: 68px; height: 68px; flex: 0 0 68px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,0.13); stroke-width: 5; }
.ring-fg {
  fill: none;
  stroke: var(--green);
  stroke-width: 5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.4s;
}
.ring-time {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}

.tinfo { min-width: 0; }
.tname {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tmeta { font-size: 12.5px; color: var(--sub); margin-top: 3px; }

.tflip {
  margin-top: 3px;
  font-size: 13px;
  font-weight: 800;
  color: var(--bg);
  background: var(--amber);
  border-radius: 8px;
  padding: 3px 7px;
  display: inline-block;
  animation: flipflash 0.6s steps(2) infinite;
}
@keyframes flipflash { 50% { opacity: 0.35; } }

.tbtns { display: flex; gap: 6px; }
.tb {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  background: rgba(255,255,255,0.09);
  font-size: 15px;
  font-weight: 700;
}
.tb:active { background: rgba(255,255,255,0.2); }
.tb-x { flex: 0 0 52px; color: var(--sub); }

/* READY state — loud on purpose */
.tcard.ready {
  background: var(--red-deep);
  border-color: var(--red);
  animation: readypulse 1s ease-in-out infinite;
}
@keyframes readypulse {
  50% { box-shadow: 0 0 0 5px rgba(255, 83, 71, 0.45); background: #e03328; }
}
.tcard.ready .ring-time { font-size: 15px; }
.tcard.ready .ring-bg { stroke: rgba(0,0,0,0.25); }
.tready-label {
  margin-top: 2px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.4px;
}
.tdone-row { display: flex; gap: 6px; }
.tb-more {
  flex: 0 0 38%;
  min-height: 50px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
  font-weight: 800;
}
.tb-done {
  flex: 1;
  min-height: 50px;
  border-radius: 10px;
  background: #fff;
  color: var(--red-deep);
  font-size: 17px;
  font-weight: 900;
}
.tb-done:active { background: var(--cream); }

/* ---------------- mini sticky bar ---------------- */
#minibar[hidden] { display: none; }
#minibar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(15, 29, 25, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  text-align: left;
}
#minibar .mb-time {
  font-size: 24px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}
#minibar.ready .mb-time { color: var(--red); animation: flipflash 0.7s steps(2) infinite; }
#minibar .mb-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#minibar .mb-up { margin-left: auto; color: var(--sub); font-size: 18px; }

/* ---------------- filters ---------------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(var(--bg) 82%, transparent);
  padding: 8px 0 10px;
}
.filters-inner { max-width: 1100px; margin: 0 auto; padding: 0 10px; }

#modes {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
}
.seg {
  flex: 1;
  min-height: 42px;
  font-size: 15px;
  font-weight: 700;
  color: var(--sub);
}
.seg.on { background: var(--red-deep); color: #fff; }

#cats {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
#cats::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 99px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}
.chip.on { background: var(--cream); color: #14241d; border-color: var(--cream); font-weight: 800; }

/* ---------------- menu grid ---------------- */
#grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4px 10px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 9px;
}

.mcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.mcard.one-tap { cursor: pointer; }
.mcard.one-tap:active { background: var(--card-hi); }

.mimg { aspect-ratio: 8 / 5; background: #101e18; }
.mimg img { width: 100%; height: 100%; object-fit: cover; display: block; }

.mname {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.22;
  padding: 7px 9px 0;
  min-height: 42px;
}
.mcal { font-size: 12px; color: var(--sub); padding: 1px 9px 6px; min-height: 21px; }

.mbtns { display: flex; gap: 6px; padding: 0 7px 8px; margin-top: auto; }
.go {
  flex: 1;
  min-height: 46px;
  border-radius: 10px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.13);
  font-size: 15.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.go:active { background: rgba(255,255,255,0.24); }
.go.dim { opacity: 0.35; }
.go.pulse { animation: gopulse 0.45s ease; }
@keyframes gopulse {
  0% { transform: scale(1); background: var(--green); color: #06130c; }
  100% { transform: scale(1); }
}

/* ---------------- toast ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 80px);
  background: var(--cream);
  color: #14241d;
  font-size: 14.5px;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 99px;
  white-space: nowrap;
  max-width: 92vw;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
  z-index: 30;
}
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------------- footer ---------------- */
footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 6px 14px 20px;
  color: var(--sub);
  font-size: 12px;
  text-align: center;
}
footer a { color: var(--sub); }

/* larger phones / desktop */
@media (min-width: 700px) {
  h1 { font-size: 26px; }
  #tray { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  #grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
  #minibar { padding-left: 24px; padding-right: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .tcard.ready, .tflip, #minibar.ready .mb-time, #sound-pill { animation: none; }
}
