/* settings.css — the Settings view (SPEC §13). Prefix s-. Shared classes (.panel .btn .seg .pill .field .sub …)
   come from app.css and are never restyled here; the chrome variables are app.css's, with the mockup's
   parchment values as fallbacks. */

.s-view { max-width: 1100px; margin: 0 auto; padding: 4px 0 40px; }

.s-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 14px; min-height: 44px; }
.s-title { margin: 0; font-weight: 700; font-size: 30px; color: #f3e4c4; letter-spacing: .5px; text-shadow: 3px 3px 0 var(--shadow, #0f0a08); }

/* "Saved" pill: lives in the header, fades in for a moment after each save */
.s-saved { opacity: 0; transform: translateY(-4px); transition: opacity .18s ease, transform .18s ease; pointer-events: none; }
.s-saved.on { opacity: 1; transform: none; }

.s-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 16px; align-items: start; }
.s-tzpanel, .s-timer { grid-row: span 2; }

/* ---- panels ------------------------------------------------------------------ */
.s-panel { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; }
.s-h { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 600; font-size: 24px; color: var(--ink, #3b2616); line-height: 1.1; }
.s-ico { width: 22px; height: 22px; image-rendering: pixelated; image-rendering: crisp-edges; flex: none; }
.s-psub { margin: -4px 0 4px; }

.s-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 8px 0; border-top: 2px dotted var(--line, #cfae7a); }
.s-row:first-of-type, .s-psub + .s-row, .s-h + .s-row { border-top: 0; }
.s-lbl { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.s-name { font-weight: 700; color: var(--ink, #3b2616); font-size: 16px; }
.s-sub { font-size: 13px; line-height: 1.35; }
.s-ctl { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.s-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- pixel stepper: wood −/+ blocks around a Silkscreen number ---------------- */
.s-stepper { display: flex; align-items: center; gap: 6px; }
.s-step { width: 36px; height: 36px; display: grid; place-items: center; padding: 0 0 3px; font-size: 24px; line-height: 1; cursor: pointer; color: #f3e4c4;
  background: var(--frame, #6b4a2e); border: 3px solid var(--frameD, #3a2416); box-shadow: inset 0 0 0 2px var(--frameL, #a97f55), 3px 3px 0 var(--shadow, #0f0a08); user-select: none; }
.s-step:hover { background: var(--frameL, #a97f55); }
.s-step:active { transform: translate(2px, 2px); box-shadow: inset 0 0 0 2px var(--frameL, #a97f55), 1px 1px 0 var(--shadow, #0f0a08); }
.s-step:disabled { opacity: .4; cursor: default; transform: none; box-shadow: inset 0 0 0 2px var(--frameL, #a97f55), 3px 3px 0 var(--shadow, #0f0a08); background: var(--frame, #6b4a2e); }
.s-step:focus-visible, .s-play:focus-visible, .s-tz:focus-visible, .s-toggle-in:focus-visible + .s-knob { outline: 3px solid var(--gold, #b8771a); outline-offset: 2px; }
.s-val { width: 64px; height: 36px; text-align: center; font-size: 18px; color: var(--ink, #3b2616); background: var(--field, #fff8e6);
  border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 3px 3px 0 #e2d3b8; padding: 2px 0 0; -moz-appearance: textfield; }
.s-val::-webkit-outer-spin-button, .s-val::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.s-val:focus { outline: 3px solid var(--gold, #b8771a); outline-offset: 1px; }
.s-unit { min-width: 2.2em; white-space: nowrap; }

/* ---- pixel toggle ------------------------------------------------------------ */
.s-toggle { position: relative; display: inline-block; width: 58px; height: 30px; cursor: pointer; flex: none; }
.s-toggle-in { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; left: 0; top: 0; cursor: pointer; }
.s-knob { position: absolute; inset: 0; background: var(--panel2, #e6d2a8); border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 0 -3px 0 var(--line, #cfae7a), 3px 3px 0 var(--shadow, #0f0a08); transition: background .15s ease; }
.s-knob::before { content: ""; position: absolute; left: 2px; top: 2px; width: 20px; height: 20px; background: #f3e4c4; border: 2px solid var(--edge, #4a2f1d); box-shadow: inset -3px -3px 0 var(--line, #cfae7a); transition: left .15s ease; }
.s-toggle-in:checked + .s-knob { background: #5aa14a; box-shadow: inset 0 -3px 0 #2f6a2e, 3px 3px 0 var(--shadow, #0f0a08); }
.s-toggle-in:checked + .s-knob::before { left: 28px; background: #fff6e8; box-shadow: inset -3px -3px 0 #c9e59a; }
.s-row-toggle .s-ctl { align-self: start; padding-top: 2px; }

/* ---- sound ------------------------------------------------------------------- */
.s-play { width: 36px; height: 36px; display: grid; place-items: center; padding: 0 0 0 2px; font-size: 16px; line-height: 1; cursor: pointer; color: #fff6e8;
  background: var(--btn, #d9413a); border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 0 -4px 0 var(--btn-dk, #9a2622), 3px 3px 0 var(--shadow, #0f0a08); text-shadow: 1px 1px 0 var(--btn-dk, #9a2622); }
.s-play:hover { filter: brightness(1.06); }
.s-play:active { transform: translate(2px, 2px); box-shadow: inset 0 -4px 0 var(--btn-dk, #9a2622), 1px 1px 0 var(--shadow, #0f0a08); }
.s-listen { white-space: nowrap; }
.s-listen[aria-pressed="true"] { color: var(--ink, #3b2616); }

/* ---- timezone ---------------------------------------------------------------- */
.s-tzcurrent { margin: 0 0 4px; font-weight: 700; color: var(--ink, #3b2616); display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.s-tzpill { font-family: Silkscreen, monospace; font-size: 11px; white-space: nowrap; }
.s-tzsearch { width: 100%; font: inherit; font-size: 16px; padding: 9px 12px; color: var(--ink, #3b2616); background: var(--field, #fff8e6);
  border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 3px 3px 0 #e2d3b8; -webkit-appearance: none; appearance: none; }
.s-tzsearch:focus { outline: 3px solid var(--gold, #b8771a); outline-offset: 1px; }
.s-tzsearch::-webkit-search-cancel-button { -webkit-appearance: none; }
.s-tzlist { max-height: 360px; overflow-y: auto; border: 3px solid var(--edge, #4a2f1d); background: var(--field, #fff8e6); box-shadow: inset 0 0 0 2px #e2d3b8; scrollbar-width: thin; overscroll-behavior: contain; }
.s-tzgroup { position: sticky; top: 0; z-index: 1; font-size: 15px; font-weight: 600; color: var(--muted, #7f6448); background: var(--panel2, #e6d2a8); padding: 4px 12px; border-bottom: 2px solid var(--line, #cfae7a); letter-spacing: .3px; }
.s-tz { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; font: inherit; color: var(--ink, #3b2616);
  background: transparent; border: 0; border-bottom: 2px dotted var(--line, #cfae7a); padding: 7px 12px; cursor: pointer; }
.s-tz:last-child { border-bottom: 0; }
.s-tz:hover { background: rgba(184, 119, 26, .12); }
.s-tz.on { background: var(--panel2, #e6d2a8); box-shadow: inset 4px 0 0 var(--btn, #d9413a); }
.s-tz-main { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-width: 0; }
.s-tz-city { font-weight: 700; }
.s-tz-id { font-size: 12px; overflow-wrap: anywhere; }
.s-tz-badge { font-family: "Pixelify Sans", monospace; font-size: 12px; line-height: 1; padding: 2px 6px 3px; background: var(--panel2, #e6d2a8); color: var(--muted, #7f6448); border: 2px solid var(--line, #cfae7a); }
.s-tz-badge.on { background: var(--gold, #b8771a); color: #fff6e8; border-color: var(--edge, #4a2f1d); }
.s-tz-time { font-size: 13px; color: var(--accent, #b8332b); white-space: nowrap; flex: none; padding-top: 2px; }
.s-tzmore { padding: 8px 12px; font-size: 13px; }

/* ---- PIN --------------------------------------------------------------------- */
.s-pinform { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.s-pinform .s-field:first-child { grid-column: 1 / -1; }
.s-field label { display: block; font-size: 13px; font-weight: 700; color: var(--muted, #7f6448); margin-bottom: 4px; }
.s-field input { width: 100%; font: inherit; font-family: Silkscreen, monospace; font-size: 18px; letter-spacing: 3px; padding: 8px 12px; color: var(--ink, #3b2616); background: var(--field, #fff8e6);
  border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 3px 3px 0 #e2d3b8; }
.s-field input:focus { outline: 3px solid var(--gold, #b8771a); outline-offset: 1px; }
.s-pinactions { grid-column: 1 / -1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 4px; }
.s-pinbtn:disabled { opacity: .55; cursor: default; }
.s-msg { grid-column: 1 / -1; margin: 0; min-height: 1.4em; font-size: 14px; font-weight: 700; color: var(--muted, #7f6448); }
.s-msg.err { color: var(--accent, #b8332b); }
.s-msg.ok { color: #2f6a2e; }

/* ---- about ------------------------------------------------------------------- */
.s-version { margin: 0; font-size: 13px; color: var(--gold, #b8771a); }
.s-made { margin: -6px 0 2px; }
.s-row-btn .s-ctl { align-self: center; }

/* ---- ideas for the garden (SPEC §17b) ---------------------------------------- */
.s-ideas { grid-column: 1 / -1; }
.s-ideas-form { display: flex; flex-direction: column; gap: 8px; }
.s-ideas-text { width: 100%; min-height: 96px; resize: vertical; font: inherit; font-size: 16px; line-height: 1.4; padding: 9px 12px; color: var(--ink, #3b2616);
  background: var(--field, #fff8e6); border: 3px solid var(--edge, #4a2f1d); box-shadow: inset 3px 3px 0 #e2d3b8; border-radius: 0; -webkit-appearance: none; appearance: none; }
.s-ideas-text:focus { outline: 3px solid var(--gold, #b8771a); outline-offset: 1px; }
.s-ideas-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.s-ideas-send:disabled { opacity: .55; cursor: default; }
.s-ideas-h { margin: 8px 0 0; font-size: 18px; font-weight: 700; color: var(--ink, #3b2616); line-height: 1.2; }
.s-ideas-status { margin: 0; font-size: 14px; }
.s-ideas-status[hidden] { display: none; }
.s-ideas-status .addlink { margin-top: 0; }
.s-ideas-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.s-idea { padding: 10px 0; border-top: 2px dotted var(--line, #cfae7a); }
.s-idea:first-child { border-top: 0; padding-top: 2px; }
.s-idea-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.s-idea-date { font-size: 13px; white-space: nowrap; }
.s-idea-del { margin-top: 0; font-size: 13px; flex: none; }
.s-idea-del:disabled { opacity: .5; cursor: default; }
.s-idea-del:focus-visible, .s-ideas-retry:focus-visible { outline: 3px solid var(--gold, #b8771a); outline-offset: 2px; }
.s-idea-text { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink, #3b2616); font-size: 15px; line-height: 1.45; }

/* ---- phones ------------------------------------------------------------------ */
@media (max-width: 860px) {
  .s-grid { grid-template-columns: 1fr; }
  .s-tzpanel, .s-timer { grid-row: auto; }
  .s-title { font-size: 26px; }
}
@media (max-width: 480px) {
  .s-panel { padding: 14px 14px 16px; }
  .s-row { grid-template-columns: 1fr; gap: 6px; }
  .s-ctl, .s-inline { justify-content: flex-start; }
  .s-row-toggle { grid-template-columns: minmax(0, 1fr) auto; }
  .s-row-toggle .s-ctl { justify-content: flex-end; }
  .s-pinform { grid-template-columns: 1fr; }
  .s-tzlist { max-height: 300px; }
}
@media (prefers-reduced-motion: reduce) {
  .s-saved, .s-knob, .s-knob::before { transition: none; }
}
