:root{
  --harbor-deep:#16262e;
  --harbor:#223843;
  --harbor-line:#2c4653;
  --brass:#e08d3c;
  --brass-deep:#b06e28;
  --sand:#f4ebd0;
  --sand-dim:#cfc4a4;
  --graphite:#5b6670;
  --blue-stage:#3f7fa8;
  --ink:#f4ebd0;
  --ink-dim:#9fb0ba;
  --flap-face:#25404d;
  --flap-line:#1a2e38;
  --danger:#c85a4a;
  --tabbar-h:64px;
  --safe-b:env(safe-area-inset-bottom, 0px);
  --safe-t:env(safe-area-inset-top, 0px);
  --radius:14px;
}

*{box-sizing:border-box;margin:0;padding:0;-webkit-tap-highlight-color:transparent}
html{font-size:16px}
body{
  background:var(--harbor-deep);
  color:var(--ink);
  font-family:"Avenir Next","Trebuchet MS","Segoe UI",Verdana,sans-serif;
  min-height:100dvh;
  overscroll-behavior-y:none;
}
button{font:inherit;color:inherit;background:none;border:0;cursor:pointer}
input{font:inherit}

.harbor{
  min-height:100dvh;
  background:
    radial-gradient(120% 55% at 50% -6%, rgba(240,230,205,.07), transparent 62%),
    repeating-linear-gradient(180deg, rgba(255,255,255,.018) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #1d3038 0%, var(--harbor-deep) 55%, #121d23 100%);
  padding-top:calc(10px + var(--safe-t));
  padding-bottom:calc(var(--tabbar-h) + var(--safe-b) + 8px);
}

.views{padding:0 14px}
.view{animation:viewin .18s ease-out}
@keyframes viewin{from{opacity:.35;transform:translateY(4px)}to{opacity:1;transform:none}}

/* ---------- header ---------- */
.fliphead{margin-bottom:16px}
.fliphead-row{display:flex;align-items:stretch;gap:10px;margin-bottom:12px}
.brand-tile{
  display:flex;flex-direction:column;justify-content:space-between;
  background:linear-gradient(180deg,#2a4553 0%,#203844 100%);
  border:1px solid var(--flap-line);
  border-radius:8px;
  padding:6px 8px;
  min-width:52px;
  box-shadow:inset 0 1px 0 rgba(244,235,208,.14), 0 3px 8px rgba(0,0,0,.35);
}
.brand-tile span{
  font-size:.6rem;letter-spacing:.18em;font-weight:700;color:var(--sand-dim);
  text-align:center;
  border-bottom:1px solid var(--flap-line);
  padding:2px 0;
}
.brand-tile span:last-child{border-bottom:0}
.brand-tile .brand-top{color:var(--brass)}
.fliphead-right{flex:1;display:flex;align-items:flex-end;justify-content:space-between;gap:10px}
.appword{
  font-size:1.5rem;font-weight:800;letter-spacing:.06em;color:var(--sand);
  text-shadow:0 2px 0 rgba(0,0,0,.4);
}
.todo-counter{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  background:linear-gradient(180deg,#2a4553,#203844);
  border:1px solid var(--flap-line);border-radius:8px;
  min-width:64px;padding:6px 10px;
  box-shadow:inset 0 1px 0 rgba(244,235,208,.12), 0 3px 8px rgba(0,0,0,.35);
}
.todo-num{
  font-size:1.6rem;font-weight:800;color:var(--brass);line-height:1;
  border-bottom:1px solid var(--flap-line);width:100%;text-align:center;padding-bottom:4px;
}
.todo-label{font-size:.6rem;letter-spacing:.22em;color:var(--ink-dim);margin-top:4px}

.brass-strip{
  position:relative;display:flex;align-items:center;gap:10px;width:100%;
  background:linear-gradient(180deg, var(--brass) 0%, var(--brass-deep) 100%);
  color:#2b1c08;
  border-radius:10px;padding:14px 16px;
  font-weight:800;letter-spacing:.08em;font-size:1rem;
  box-shadow:0 4px 10px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.35);
}
.brass-strip:active{transform:translateY(1px)}
.strip-notch{
  width:14px;height:14px;border-radius:50%;
  background:var(--harbor-deep);box-shadow:inset 0 1px 2px rgba(0,0,0,.5);
  flex:0 0 auto;
}
.strip-word{flex:1;text-align:left}
.strip-slit{
  width:26px;height:3px;border-radius:2px;background:rgba(43,28,8,.55);
  flex:0 0 auto;
}
.strip-slit2{width:18px}

/* ---------- split-flap focus card ---------- */
.focus-card{
  position:relative;
  background:linear-gradient(180deg,#2a4553 0%,#243d49 100%);
  border:1px solid var(--flap-line);
  border-radius:var(--radius);
  overflow:hidden;
  box-shadow:0 8px 20px rgba(0,0,0,.45), inset 0 1px 0 rgba(244,235,208,.1);
  margin-bottom:14px;
}
.focus-edge{position:absolute;left:0;top:0;bottom:0;width:6px;background:var(--blue-stage)}
.focus-edge.is-packed{background:var(--sand)}
.focus-edge.is-ready{background:var(--graphite)}
.focus-hinge{
  position:absolute;top:50%;left:14px;transform:translateY(-50%);
  width:10px;height:10px;border-radius:50%;
  background:radial-gradient(circle at 34% 30%, #f0c07a, var(--brass-deep) 70%);
  box-shadow:0 1px 3px rgba(0,0,0,.6);
}
.focus-flap{
  display:block;width:100%;text-align:left;
  padding:20px 18px 20px 40px;
}
.focus-split{position:relative;margin-bottom:10px}
.focus-split::after{
  content:"";position:absolute;left:0;right:0;top:50%;height:2px;
  background:var(--flap-line);
}
.focus-word{
  display:block;font-size:2rem;font-weight:800;line-height:1.14;
  color:var(--sand);word-break:break-word;
}
.focus-sub{
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
  font-size:.85rem;color:var(--ink-dim);margin-top:10px;
}
.focus-sub b{color:var(--sand);font-weight:700}
.stage-word{
  display:inline-flex;align-items:center;gap:6px;
  font-size:.72rem;letter-spacing:.16em;font-weight:700;
  padding:4px 10px;border-radius:999px;
  border:1px solid var(--flap-line);
  background:rgba(0,0,0,.25);
}
.stage-word .dot{margin:0}
.hint-tap{
  display:block;margin-top:12px;font-size:.7rem;letter-spacing:.14em;
  color:var(--brass);text-transform:uppercase;
}
.focus-empty{padding:8px 4px}

/* split-flap empty slot */
.empty-slot{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:28px 18px;
  border:1px dashed var(--harbor-line);
  border-radius:var(--radius);
  background:repeating-linear-gradient(180deg, rgba(244,235,208,.035) 0 3px, transparent 3px 10px);
  text-align:center;
}
.empty-flap{
  width:84px;height:52px;border-radius:8px;
  background:linear-gradient(180deg,#2a4553 0%,#223a46 49%,#1c313b 51%,#223a46 100%);
  border:1px solid var(--flap-line);
  position:relative;
}
.empty-flap::after{
  content:"";position:absolute;left:0;right:0;top:50%;height:2px;background:var(--flap-line);
}
.empty-word{font-size:.9rem;color:var(--ink-dim)}
.empty-note{font-size:.75rem;color:#6f828d;max-width:26ch}

/* ---------- board ---------- */
.board-head{display:flex;align-items:baseline;justify-content:space-between;margin:6px 2px 14px}
.board-title{font-size:1.2rem;font-weight:800;letter-spacing:.05em;color:var(--sand)}
.board-meta{font-size:.72rem;letter-spacing:.12em;color:var(--ink-dim)}
.board-stack{display:flex;flex-direction:column;gap:18px}
.stage-group h3{
  display:flex;align-items:center;gap:8px;
  font-size:.72rem;letter-spacing:.2em;text-transform:uppercase;
  color:var(--ink-dim);margin:0 2px 8px;
}
.group-count{
  font-size:.68rem;color:var(--brass);letter-spacing:.05em;
  border:1px solid var(--flap-line);border-radius:999px;padding:1px 8px;
}
.rows{display:flex;flex-direction:column;gap:8px}
.stub-row{
  position:relative;display:flex;align-items:center;gap:10px;width:100%;
  background:linear-gradient(180deg,#2a4553,#243d49);
  border:1px solid var(--flap-line);
  border-radius:10px;
  padding:12px 14px 12px 26px;
  text-align:left;
  box-shadow:0 3px 8px rgba(0,0,0,.35), inset 0 1px 0 rgba(244,235,208,.08);
}
.stub-row:active{transform:translateY(1px)}
.stub-edge{position:absolute;left:0;top:0;bottom:0;width:5px;border-radius:10px 0 0 10px;background:var(--blue-stage)}
.stub-edge.is-packed{background:var(--sand)}
.stub-edge.is-ready{background:var(--graphite)}
.stub-hinge{
  position:absolute;top:50%;left:11px;transform:translateY(-50%);
  width:8px;height:8px;border-radius:50%;
  background:radial-gradient(circle at 34% 30%, #f0c07a, var(--brass-deep) 70%);
}
.stub-main{flex:1;min-width:0}
.stub-action{
  display:block;font-weight:700;color:var(--sand);font-size:.98rem;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.stub-meta{
  display:block;font-size:.78rem;color:var(--ink-dim);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px;
}
.stub-stage{flex:0 0 auto}

.dot{
  width:10px;height:10px;border-radius:50%;display:inline-block;flex:0 0 auto;
  border:2px solid currentColor;
}
.dot-filled{background:currentColor}
.dot-hollow{background:transparent}
.is-todo .dot{color:var(--blue-stage)}
.is-packed .dot{color:var(--sand)}
.is-ready .dot{color:#9aa7b0}
.stage-chip{
  display:inline-flex;align-items:center;gap:6px;
  font-size:.66rem;letter-spacing:.14em;text-transform:uppercase;font-weight:700;
}
.stage-chip.is-todo{color:#7db2d4}
.stage-chip.is-packed{color:var(--sand)}
.stage-chip.is-ready{color:#9aa7b0}

/* ---------- ticket form ---------- */
.ticket-head{margin:6px 0 12px;position:relative}
.ticket-perf{
  height:6px;width:64px;border-radius:3px;margin-bottom:10px;
  background:repeating-linear-gradient(90deg, var(--brass) 0 10px, transparent 10px 16px);
}
.ticket-title{font-size:1.2rem;font-weight:800;letter-spacing:.04em;color:var(--sand)}
.ticket-panel{
  position:relative;
  background:linear-gradient(180deg,#2a4553,#243d49);
  border:1px solid var(--flap-line);
  border-radius:var(--radius);
  padding:18px 16px 20px;
  box-shadow:0 8px 20px rgba(0,0,0,.4), inset 0 1px 0 rgba(244,235,208,.1);
  display:flex;flex-direction:column;gap:14px;
}
.field{display:flex;flex-direction:column;gap:6px;border:0}
.flabel{
  font-size:.68rem;letter-spacing:.18em;text-transform:uppercase;
  color:var(--ink-dim);font-weight:700;
}
.finput{
  width:100%;
  background:#1b2f39;
  border:1px solid var(--harbor-line);
  border-radius:10px;
  color:var(--ink);
  padding:13px 14px;
  font-size:1rem;
  -webkit-appearance:none;appearance:none;
}
.finput::placeholder{color:#5f7480}
.finput:focus{outline:none;border-color:var(--brass);box-shadow:0 0 0 2px rgba(224,141,60,.25)}
.finput.invalid{border-color:var(--danger);box-shadow:0 0 0 2px rgba(200,90,74,.25)}

.stage-picker{display:flex;gap:8px}
.stage-opt{
  flex:1;display:flex;align-items:center;justify-content:center;gap:6px;
  padding:12px 4px;border-radius:10px;
  border:1px solid var(--harbor-line);
  background:#1b2f39;
  font-size:.82rem;font-weight:700;letter-spacing:.06em;
  color:var(--ink-dim);
  min-height:46px;
}
.stage-opt[aria-checked="true"]{border-color:var(--brass);color:var(--sand);background:#24404d;box-shadow:inset 0 0 0 1px rgba(224,141,60,.4)}
.form-error{
  color:#f0a396;background:rgba(200,90,74,.14);
  border:1px solid rgba(200,90,74,.4);border-radius:8px;
  padding:10px 12px;font-size:.82rem;
}
.ticket-actions{display:flex;gap:8px;flex-wrap:wrap}
.btn{
  flex:1;min-height:48px;border-radius:10px;
  font-weight:800;letter-spacing:.08em;font-size:.9rem;
  padding:12px 14px;
  transition:transform .06s ease;
}
.btn:active{transform:translateY(1px)}
.btn-brass{
  background:linear-gradient(180deg, var(--brass), var(--brass-deep));
  color:#2b1c08;box-shadow:0 3px 8px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.3);
}
.btn-ghost{border:1px solid var(--harbor-line);color:var(--ink-dim)}
.btn-danger{border:1px solid rgba(200,90,74,.5);color:#f0a396}
.btn-wide{width:100%;flex:none}
.ticket-stub-edge{
  display:flex;justify-content:space-between;
  margin:4px -16px -20px;padding:0 12px 8px;
}
.ticket-stub-edge span{
  width:10px;height:10px;border-radius:50%;
  background:var(--harbor-deep);
  box-shadow:inset 0 1px 2px rgba(0,0,0,.5);
}

/* ---------- find ---------- */
.find-head{margin:6px 0 12px}
.searchslot{
  position:relative;display:flex;align-items:center;
  background:linear-gradient(180deg,#2a4553,#243d49);
  border:1px solid var(--flap-line);border-radius:12px;
  box-shadow:0 4px 10px rgba(0,0,0,.35);
}
.search-hinge{
  width:9px;height:9px;border-radius:50%;margin-left:14px;flex:0 0 auto;
  background:radial-gradient(circle at 34% 30%, #f0c07a, var(--brass-deep) 70%);
}
.search-input{
  flex:1;background:transparent;border:0;color:var(--ink);
  padding:14px 14px 14px 12px;font-size:1rem;min-width:0;
  -webkit-appearance:none;appearance:none;
}
.search-input::placeholder{color:#5f7480}
.search-input:focus{outline:none}
.searchslot:focus-within{border-color:var(--brass)}
.find-results{display:flex;flex-direction:column;gap:8px;margin-bottom:20px}

/* ---------- about ---------- */
.about-panel{
  background:linear-gradient(180deg,#2a4553,#243d49);
  border:1px solid var(--flap-line);border-radius:var(--radius);
  padding:16px;display:flex;flex-direction:column;gap:14px;
  box-shadow:0 6px 16px rgba(0,0,0,.4);
}
.about-title{font-size:.75rem;letter-spacing:.2em;text-transform:uppercase;color:var(--brass)}
.about-copy{font-size:.85rem;color:var(--ink-dim);line-height:1.5}
.about-facts{
  display:flex;flex-direction:column;gap:6px;
  border-top:1px solid var(--flap-line);border-bottom:1px solid var(--flap-line);
  padding:10px 0;
}
.about-facts div{display:flex;justify-content:space-between;font-size:.82rem}
.about-facts dt{color:var(--ink-dim)}
.about-facts dd{color:var(--sand);font-weight:700}

/* ---------- tab bar ---------- */
.tabbar{
  position:fixed;left:0;right:0;bottom:0;z-index:20;
  display:flex;
  background:linear-gradient(180deg,#1d3038,#16242b);
  border-top:1px solid var(--harbor-line);
  padding-bottom:var(--safe-b);
  height:calc(var(--tabbar-h) + var(--safe-b));
}
.tab{
  flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;
  color:#6f828d;min-height:48px;
  transition:color .15s ease;
}
.tab .wheel{width:24px;height:24px}
.wheel-rim{fill:#1b2f39;stroke:currentColor;stroke-width:1.8}
.wheel-hub{fill:currentColor;stroke:none}
.wheel-spoke{stroke:currentColor;stroke-width:1.6;stroke-linecap:round;fill:none}
.tab-word{font-size:.62rem;letter-spacing:.14em;text-transform:uppercase;font-weight:700}
.tab[aria-current="page"]{color:var(--brass)}
.tab[aria-current="page"] .wheel{
  transform:rotate(14deg);
  filter:drop-shadow(0 2px 3px rgba(224,141,60,.35));
  transition:transform .18s ease;
}

@media (min-width:560px){
  .views,.harbor{max-width:560px;margin:0 auto}
  .harbor{width:100%}
}
