:root {
  --navy: #062348;
  --navy-2: #0d3468;
  --sky: #5391c5;
  --sky-deep: #3d7ab0;
  --ice: #eaf3fb;
  --bg: #f4f8fc;
  --card: #ffffff;
  --text: #0b1f36;
  --muted: #5c6b7a;
  --line: #dbe6f1;
  --ok: #1e9e62;
  --warn: #c9721b;
  --err: #c43d3d;
  --radius: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #040f1e;
    --card: #0a1c33;
    --text: #e6eef7;
    --muted: #8aa3bd;
    --line: #1a3350;
    --ice: #0d2440;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }

.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--navy);
  color: #fff;
}
.mark { width: 28px; height: auto; filter: brightness(0) invert(1); }
.mark-lg { width: 96px; height: auto; margin-bottom: 8px; }
.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand-en { font-weight: 800; letter-spacing: .12em; font-size: 15px; }
.brand-ja { font-size: 11px; opacity: .8; letter-spacing: .08em; }

.screen {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 0;
  display: flex;
  flex-direction: column;
}
.screen.center { align-items: center; justify-content: center; text-align: center; padding-bottom: 40px; }
.spacer { flex: 1; min-height: 24px; }
h1 { font-size: 22px; margin: 8px 0; line-height: 1.4; }
.title { margin-top: 2px; }
.for { margin: 0; color: var(--sky-deep); font-weight: 700; font-size: 14px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center-text { text-align: center; margin-top: 0; }

.pick-main {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  margin-top: 16px;
  min-height: 150px;
  border: 2px dashed var(--sky);
  border-radius: var(--radius);
  background: var(--ice);
  color: var(--navy);
  font-weight: 700; font-size: 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) { .pick-main { color: #fff; } }
.pick-main:active { transform: scale(.99); }
.pick-icon {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: grid; place-items: center;
}
.pick-sub {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-top: 12px;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-weight: 600; font-size: 15px;
  cursor: pointer;
}

.list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.thumb {
  width: 48px; height: 48px; border-radius: 8px; object-fit: cover;
  background: var(--ice); color: var(--sky-deep);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; letter-spacing: .04em;
  overflow: hidden;
}
.meta { min-width: 0; }
.name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--muted); }
.sub.ok { color: var(--ok); font-weight: 700; }
.sub.warn { color: var(--warn); font-weight: 700; }
.sub.err { color: var(--err); font-weight: 700; }
.x {
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 22px; cursor: pointer;
}
.bar-mini { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.bar-mini > i { display: block; height: 100%; width: 0; background: var(--sky); transition: width .3s; }
.item.done .bar-mini > i { background: var(--ok); }
.tick { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; }
.tick.ok { background: var(--ok); color: #fff; }
.tick.err { background: var(--err); color: #fff; }

.note-wrap { margin-top: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.note-wrap summary { cursor: pointer; font-weight: 600; font-size: 15px; min-height: 28px; }
.note-wrap textarea {
  width: 100%; margin-top: 10px; padding: 10px; font: inherit; font-size: 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical;
}

.dock {
  position: sticky; bottom: 0;
  margin: 0 -16px;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
  display: flex; flex-direction: column; gap: 8px;
}
.btn {
  width: 100%; min-height: 56px;
  border: 0; border-radius: 14px;
  font: inherit; font-size: 17px; font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.99); }
.btn.primary { background: var(--navy); color: #fff; }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--sky-deep); } }
.btn.primary:disabled { background: var(--line); color: var(--muted); cursor: default; }
.btn.secondary { background: var(--ice); color: var(--navy); border: 1px solid var(--sky); }
@media (prefers-color-scheme: dark) { .btn.secondary { color: #fff; } }
.btn.ghost { background: transparent; color: var(--muted); min-height: 48px; font-weight: 600; }

.ring-wrap { position: relative; width: 168px; height: 168px; margin: 12px auto 4px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 10; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--sky); stroke-linecap: round; stroke-dasharray: 326.73; stroke-dashoffset: 326.73; transition: stroke-dashoffset .4s; }
.ring-fg.done { stroke: var(--ok); }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 800; color: var(--text); }
.ring-label small { font-size: 18px; margin-left: 2px; }
.status-line { text-align: center; font-weight: 700; font-size: 18px; margin: 4px 0 2px; }
.keep-open {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ice);
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}

.big-icon { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px; font-size: 44px; font-weight: 800; }
.big-icon.ok { background: var(--ok); color: #fff; }
.big-icon.warn { background: var(--warn); color: #fff; }
.list.compact { width: 100%; text-align: left; }
.screen.center .dock, .screen.center .spacer { align-self: stretch; }

.spinner { width: 36px; height: 36px; border: 4px solid var(--line); border-top-color: var(--sky); border-radius: 50%; animation: spin 1s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.foot { text-align: center; font-size: 11px; letter-spacing: .2em; color: var(--muted); padding: 10px 0 calc(10px + var(--safe-b)); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
