/* Stop Sorter — dark, iOS-flavoured utility design.
   Principles applied from library repos #53 (Apple Design skill, MIT) and #66 (Anime.js, MIT):
   instant press feedback, spring motion on meaningful moments, translucent materials,
   size-aware typography, hairline separators, reduced-motion fallbacks. */
:root {
  --bg: #0b0b0f;
  --card: rgba(255, 255, 255, 0.06);
  --card-solid: #17171c;
  --card-raised: rgba(255, 255, 255, 0.09);
  --hairline: rgba(255, 255, 255, 0.09);
  --text: #f5f5f7;
  --muted: #98989f;
  --accent: #0a84ff;
  --accent-press: #0066cc;
  --good: #30d158;
  --bad: #ff453a;
  --warn-bg: rgba(255, 214, 10, 0.12);
  --warn-text: #ffd60a;
  --radius: 18px;
  --radius-s: 12px;
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
}
* { box-sizing: border-box; }
html { font: 112.5%/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { margin: 0; background: var(--bg); color: var(--text);
  font-optical-sizing: auto; -webkit-font-smoothing: antialiased; }
main { max-width: 560px; margin: 0 auto; padding: 20px 16px 96px; }

.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 2.4rem; line-height: 1.05; letter-spacing: -0.02em; font-weight: 700; margin: 8px 0 6px; }
.lang-btn { flex: none; background: var(--card-raised); border: 0.5px solid var(--hairline); color: var(--text);
  border-radius: 99px; padding: 10px 16px; font-size: 1.125rem; font-weight: 600; cursor: pointer; min-height: 48px; }
.lang-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 20px; }
.lang-list[hidden] { display: none; }
.lang-opt { background: var(--card); border: 0.5px solid var(--hairline); color: var(--text); border-radius: var(--radius-s);
  padding: 16px; font-size: 1.1875rem; text-align: left; cursor: pointer; min-height: 56px; }
.lang-opt.on { border-color: var(--accent); background: var(--card-raised); font-weight: 700; }
.mt-note { color: var(--muted); font-size: 0.8125rem; margin: 4px 4px 0; }
.sub { color: var(--muted); margin: 0 0 24px; font-size: 0.9375rem; letter-spacing: 0.01em; }
h2 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.01em; font-weight: 600; margin: 24px 0 12px; }
.muted { color: var(--muted); font-size: 0.9375rem; line-height: 1.45; }
.small { font-size: 0.8125rem; letter-spacing: 0.01em; }

/* --- press feedback: instant, on pointer-down (skill §1) --- */
.btn, .tick-btn, .dropzone, .routes li { transition: transform 100ms ease-out, background-color 160ms ease, opacity 160ms ease; }
.btn:active, .tick-btn:active, .dropzone:active { transform: scale(0.97); }

.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 190px; border: 1.5px dashed var(--hairline); border-radius: var(--radius);
  background: var(--card); cursor: pointer; text-align: center; padding: 28px; }
.dropzone.drag { border-color: var(--accent); background: var(--card-raised); }
.dz-icon { font-size: 3rem; line-height: 1; }
.dz-big { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.01em; }
.dz-small { color: var(--muted); font-size: 1rem; max-width: 30ch; }
.center { text-align: center; }
.big-status { font-size: 1.25rem; font-weight: 600; }

.routes ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.routes li { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--card); border: 0.5px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.routes .rname { font-weight: 600; letter-spacing: -0.01em; }
.routes .rmeta { color: var(--muted); font-size: 0.8125rem; }
.routes .btns { display: flex; gap: 8px; flex: none; }

.btn { border: 0; border-radius: var(--radius-s); padding: 16px 20px; font-size: 1.1875rem; font-weight: 600;
  letter-spacing: -0.01em; cursor: pointer; min-height: 56px; }
.btn.primary { background: var(--accent); color: #fff; width: 100%; }
.btn.primary:active { background: var(--accent-press); }
.btn.ghost { background: var(--card-raised); color: var(--text); border: 0.5px solid var(--hairline); }
.btn.small { padding: 10px 16px; font-size: 1.0625rem; min-height: 48px; }
.btn:disabled { opacity: 0.45; }
.btn:focus-visible, .tick-btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
.row-actions { display: flex; flex-direction: column; gap: 10px; margin: 20px 0; }

.progress { height: 8px; border-radius: 99px; background: var(--card-raised); overflow: hidden; margin: 16px 0; }
.progress-bar { height: 100%; width: 0; border-radius: 99px; background: var(--accent);
  transition: width 250ms var(--spring); }

.review-list, .tick-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.review-list li { background: var(--card); border: 0.5px solid var(--hairline); border-radius: var(--radius); padding: 14px; }
.review-list .fields { display: grid; grid-template-columns: 56px 1fr; gap: 10px; align-items: start; }
.review-list input { width: 100%; background: rgba(255,255,255,0.05); border: 0.5px solid var(--hairline); color: var(--text);
  border-radius: var(--radius-s); padding: 14px; font-size: 1.125rem; }
.review-list input.bad { border-color: var(--bad); }
.review-list .stopnum { font-weight: 700; color: var(--muted); text-align: center; padding-top: 10px; font-size: 1.0625rem; }
.review-list .raw { color: var(--muted); font-size: 0.75rem; margin-top: 10px; white-space: pre-wrap; word-break: break-word; opacity: 0.8; }
.review-list .del { margin-top: 8px; color: var(--bad); background: none; border: 0; font-size: 1.0625rem; padding: 10px 0; font-weight: 500; }

.tick-list li { display: flex; align-items: stretch; background: var(--card);
  border: 0.5px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
  transition: opacity 300ms var(--spring), transform 300ms var(--spring); }
.tick-list li.next { background: var(--card-raised); border-color: rgba(10, 132, 255, 0.5);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35); }
.tick-list li.done { opacity: 0.5; }
.tick-list li.done .taddr { text-decoration: line-through; }
.tick-btn { flex: 1; display: flex; align-items: center; gap: 14px; text-align: left; background: none;
  border: 0; color: var(--text); padding: 18px 16px; cursor: pointer; font-size: 1.1875rem; min-height: 84px; }
.tick-box { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center; font-size: 19px; font-weight: 700; color: #fff;
  transition: background-color 160ms ease, border-color 160ms ease; }
li.done .tick-box { background: var(--good); border-color: var(--good); }
.tnum { font-weight: 700; font-size: 1.5rem; min-width: 34px; letter-spacing: -0.02em; color: var(--text); }
li.next .tnum { color: var(--accent); }
.tbody { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.taddr { font-weight: 600; letter-spacing: -0.01em; }
.tmeta { color: var(--muted); font-size: 0.8125rem; }
.next-pill { display: inline-block; font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent); }
.nav-links { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 12px 14px;
  border-left: 0.5px solid var(--hairline); }
.nav-links a { color: var(--accent); text-decoration: none; font-size: 1.625rem; line-height: 1; padding: 6px;
  display: flex; align-items: center; min-height: 44px; }

.route-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.route-head h2 { margin: 24px 0 12px; }
.count-pill { flex: none; background: var(--card-raised); border: 0.5px solid var(--hairline);
  color: var(--muted); font-size: 0.8125rem; font-weight: 600; border-radius: 99px; padding: 5px 12px; }

.offline-note { position: fixed; left: 12px; right: 12px; bottom: 16px; background: var(--warn-bg); color: var(--warn-text);
  border: 0.5px solid rgba(255, 214, 10, 0.3); border-radius: var(--radius-s); padding: 12px 16px; font-size: 0.9375rem;
  margin: 0 auto; max-width: 532px; backdrop-filter: blur(20px) saturate(160%); -webkit-backdrop-filter: blur(20px) saturate(160%); }
textarea { width: 100%; background: rgba(255,255,255,0.05); color: var(--text); border: 0.5px solid var(--hairline);
  border-radius: var(--radius-s); padding: 12px; font-size: 0.9375rem; }

/* --- reduced motion: cross-fade instead of springs (skill §14) --- */
@media (prefers-reduced-motion: reduce) {
  .btn, .tick-btn, .dropzone, .routes li, .tick-list li, .progress-bar { transition: opacity 200ms ease, background-color 200ms ease; transform: none !important; }
  .tick-list li { transition: opacity 200ms ease; }
}

/* lock screen */
.gate { position: fixed; inset: 0; z-index: 9999; background: #0b0b0f; display: flex; align-items: center; justify-content: center; padding: 24px; transition: opacity .3s ease; }
.gate-off { opacity: 0; pointer-events: none; }
.gate-card { width: 100%; max-width: 320px; text-align: center; }
.gate-lock { font-size: 40px; margin-bottom: 12px; }
.gate-title { font-size: 22px; font-weight: 700; color: #f5f5f7; margin: 0 0 6px; }
.gate-sub { font-size: 14px; color: #9a9aa5; margin: 0 0 20px; }
.gate-card input { width: 100%; box-sizing: border-box; padding: 14px 16px; font-size: 17px; border-radius: 12px; border: 1px solid #33333d; background: #17171d; color: #f5f5f7; text-align: center; margin-bottom: 12px; }
.gate-card button { width: 100%; padding: 14px 16px; font-size: 17px; font-weight: 600; border: 0; border-radius: 12px; background: #0a84ff; color: #fff; }
.gate-error { color: #ff6961; font-size: 14px; margin: 12px 0 0; }
