:root {
  --butter: #f6e3a1;
  --butter-deep: #f2c14e;
  --butter-ink: #5a4713;
  --tomato: #d95d39;
  --tomato-ink: #9c3a1c;
  --herb: #6a994e;
  --herb-ink: #3f6d2a;
  --paper: #fffdf4;
  --line: rgba(190, 120, 40, 0.16);
  --wood: #a9702f;
  --wood-ink: #7a4d1c;
  --steel1: #f2f5f6;
  --steel2: #cfd7db;
  --steel3: #aeb9bf;
  --steel-ink: #6d7a81;
  --shadow-warm: 0 10px 22px rgba(122, 66, 20, 0.18);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font: 16px/1.45 -apple-system, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--butter-ink);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  background:
    repeating-linear-gradient(92deg, rgba(255, 255, 255, 0.10) 0 2px, transparent 2px 26px),
    radial-gradient(120% 90% at 50% 0%, #f9edb9 0%, var(--butter) 55%, #eec767 100%);
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

:focus-visible { outline: 3px solid rgba(106, 153, 78, 0.8); outline-offset: 2px; }

button { cursor: pointer; font-family: inherit; }

.tape-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: calc(6px + env(safe-area-inset-top)) 12px 12px;
}

.tape-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(252, 244, 200, 0.97), rgba(244, 226, 156, 0.95));
  box-shadow: 0 2px 8px rgba(122, 66, 20, 0.16);
  transform: rotate(-0.35deg);
  position: relative;
}

.tape-bar::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.35) 0 1.5px, transparent 1.5px 7px);
  opacity: 0.5;
  pointer-events: none;
}

.brand {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: 0.02em;
  margin-right: auto;
  color: var(--butter-ink);
  white-space: nowrap;
}

.counter-chip {
  min-width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: 1.5px dashed var(--tomato);
  background: rgba(217, 93, 57, 0.10);
  color: var(--tomato-ink);
  border-radius: 6px;
  padding: 4px 8px;
}

.counter-chip b { font-size: 18px; line-height: 1.1; }

.counter-chip span {
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.spoon-add {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid var(--wood);
  background: #f7d877;
  display: grid;
  place-items: center;
  color: var(--wood-ink);
  flex: 0 0 auto;
}

.spoon-add svg { width: 24px; height: 24px; }

main { flex: 1; padding: 6px 14px calc(104px + env(safe-area-inset-bottom)); }

.tab[hidden] { display: none; }

.tab-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1.15;
  margin: 10px 0 2px;
  color: #4a3a10;
}

.tab-sub { font-size: 13.5px; color: #8a6d1a; margin: 0 0 12px; }

.lane-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #8a6d1a;
  margin: 16px 0 2px;
}

.st-Planned { --tape: #f2c14e; --tape-ink: #8a6d1a; }
.st-Testing { --tape: #d95d39; --tape-ink: #9c3a1c; }
.st-Tasted { --tape: #6a994e; --tape-ink: #3f6d2a; }

.taped { position: relative; }

.taped::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 14px;
  width: 84px;
  height: 22px;
  background-color: var(--tape, #f2c14e);
  background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.25) 0 1.5px, transparent 1.5px 6px);
  opacity: 0.88;
  transform: rotate(-2.2deg);
  clip-path: polygon(1% 8%, 4% 0, 96% 4%, 100% 30%, 98% 96%, 92% 100%, 6% 94%, 0 62%);
  box-shadow: 0 2px 3px rgba(90, 60, 10, 0.18);
}

.card {
  position: relative;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 26px, var(--line) 26px 27px);
  border-radius: 8px;
  box-shadow: 0 3px 8px rgba(90, 60, 10, 0.15);
  margin: 20px 0 14px;
  padding: 20px 14px 12px;
  cursor: pointer;
}

.card h3 { margin: 0; font-size: 18px; line-height: 1.3; color: #4a3a10; padding-right: 8px; }

.change { margin: 2px 0 0; color: #6b5518; font-size: 14.5px; }

.meta { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }

.status-word {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--tape-ink);
}

.date { color: #a08a4a; font-size: 12px; }

.hint-ctl { margin-left: auto; font-size: 11px; color: #a08a4a; text-align: right; }

.controls {
  display: none;
  margin-top: 12px;
  border-top: 1.5px dashed rgba(122, 91, 16, 0.25);
  padding-top: 12px;
}

.card.open .controls { display: block; }

.ctl-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #8a6d1a;
  margin: 0 0 8px;
}

.seg { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.seg-btn {
  min-height: 42px;
  min-width: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--tape, #999);
  background: transparent;
  color: var(--tape-ink, #555);
  font-weight: 700;
  font-size: 14px;
}

.seg-btn.on {
  background: var(--tape);
  color: #fffdf4;
  border-color: transparent;
}

.row-actions { display: flex; gap: 10px; }

.row-actions .btn { flex: 1; }

.btn {
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15.5px;
  border: 1.5px solid transparent;
}

.btn-ghost { background: transparent; border-color: #c9a53e; color: #7a5b10; }

.btn-danger { background: transparent; border-color: var(--tomato); color: var(--tomato-ink); }

.btn-primary {
  flex: 1.4;
  background: var(--herb);
  color: #f6ffe9;
  box-shadow: 0 5px 12px rgba(63, 109, 42, 0.35);
}

.btn-cancel { flex: 1; background: transparent; border-color: #c9a53e; color: #7a5b10; }

.btn-tasted {
  width: 100%;
  background: var(--herb);
  color: #f2ffe8;
  box-shadow: 0 5px 12px rgba(63, 109, 42, 0.3);
}

.bench-top {
  display: flex;
  gap: 14px;
  align-items: stretch;
  margin: 14px 0 6px;
}

.square-counter {
  width: 108px;
  min-height: 116px;
  flex: 0 0 auto;
  background: var(--paper);
  border-radius: 10px;
  box-shadow: var(--shadow-warm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.square-counter b { font-size: 46px; line-height: 1; color: var(--tomato-ink); }

.bench-actions { flex: 1; display: flex; flex-direction: column; gap: 12px; justify-content: center; }

.spoon-action {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--wood);
  color: #ffefc9;
  border: none;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 6px 14px rgba(122, 66, 20, 0.28);
}

.spoon-action svg { width: 26px; height: 26px; flex: 0 0 auto; }

.bench-hint { font-size: 12.5px; color: #8a6d1a; margin: 0 4px; }

.search {
  width: 100%;
  min-height: 50px;
  border: 1.5px solid #dcb75a;
  border-radius: 12px;
  background: var(--paper);
  padding: 10px 14px;
  font: inherit;
  font-size: 16px;
  color: #4a3a10;
  margin: 4px 0 10px;
  box-shadow: 0 2px 5px rgba(90, 60, 10, 0.1);
  -webkit-appearance: none;
  appearance: none;
}

.search::placeholder { color: #b49a55; }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }

.chip {
  min-height: 38px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(122, 91, 16, 0.4);
  background: rgba(255, 253, 244, 0.75);
  color: #7a5b10;
  font-weight: 700;
  font-size: 13.5px;
}

.chip.active { background: #7a5b10; color: #ffefc9; border-color: #7a5b10; }

.empty {
  margin: 18px 0;
  border: 2px dashed rgba(122, 91, 16, 0.4);
  border-radius: 14px;
  padding: 26px 14px;
  text-align: center;
  color: #8a6d1a;
  background: rgba(255, 253, 244, 0.55);
  font-size: 15.5px;
  font-style: italic;
}

.form-card {
  position: relative;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(180deg, transparent 0 26px, var(--line) 26px 27px);
  border-radius: 10px;
  box-shadow: var(--shadow-warm);
  margin: 18px 0;
  padding: 26px 16px 16px;
}

.field { margin: 14px 0; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a6d1a;
  margin: 0 0 6px;
}

.field input,
.field select {
  width: 100%;
  min-height: 50px;
  padding: 12px;
  border: 1.5px solid #e0c26a;
  border-radius: 10px;
  background: #fffef8;
  font: inherit;
  font-size: 16px;
  color: #4a3a10;
}

.field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%237a5b10' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
}

#inScore::-webkit-outer-spin-button,
#inScore::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

#inScore { -moz-appearance: textfield; appearance: textfield; }

.err { display: none; margin: 6px 0 0; font-size: 13px; color: var(--tomato-ink); font-weight: 600; }

.field.invalid .err { display: block; }

.field.invalid input,
.field.invalid select { border-color: var(--tomato); }

.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.score-row { display: flex; gap: 8px; margin: 4px 0 12px; }

.score-btn {
  flex: 1;
  min-height: 44px;
  border-radius: 10px;
  border: 1.5px solid var(--tape, var(--tomato));
  background: transparent;
  color: var(--tape-ink, var(--tomato-ink));
  font-weight: 800;
  font-size: 16px;
}

.score-btn.active {
  background: var(--tape, var(--tomato));
  color: #fff7ee;
}

.about { margin: 22px 0 8px; }

.about summary {
  display: inline-block;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 8px;
  background: rgba(255, 253, 244, 0.8);
  border: 1.5px dashed #b1913d;
  color: #7a5b10;
  font-weight: 700;
  list-style: none;
}

.about summary::-webkit-details-marker { display: none; }

.about-body { margin-top: 14px; cursor: default; }

.about-body p { margin: 0 0 14px; font-size: 14.5px; color: #6b5518; }

.tray {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, var(--steel1) 0%, var(--steel2) 60%, var(--steel3) 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 -8px 18px rgba(60, 40, 10, 0.18);
}

.tray::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.6);
}

.tool {
  display: grid;
  justify-items: center;
  gap: 3px;
  background: none;
  border: none;
  color: var(--steel-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 10px;
  transition: transform 0.18s ease, color 0.18s ease, filter 0.18s ease;
}

.tool svg { width: 27px; height: 27px; }

.tool.active {
  color: var(--tomato);
  transform: translateY(-8px);
  filter: drop-shadow(0 7px 5px rgba(122, 66, 20, 0.38));
}
