:root {
  --bg: #0b0f1e;
  --win: #10162b;
  --line: #e9ecf5;
  --text: #f3f5fb;
  --dim: #9aa3bd;
  --gold: #ffd451;
  --ok: #5fd38d;
  --ready: #59b8ff;
  --warn: #ff9a5c;
  --danger: #ff6b6b;
  --top: env(safe-area-inset-top, 0px);
  --bot: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  font-size: 16px; line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  padding-bottom: calc(68px + var(--bot));
}
button, input, select, textarea { font: inherit; color: inherit; }

.top {
  position: sticky; top: 0; z-index: 5;
  padding: calc(10px + var(--top)) 16px 10px;
  background: linear-gradient(var(--bg) 80%, transparent);
}
.top h1 { margin: 0 0 6px; font-size: 18px; letter-spacing: .1em; color: var(--gold); }
.progress { font-size: 13px; color: var(--dim); }
.bar { height: 8px; border: 1px solid var(--line); border-radius: 4px; margin-top: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); }

main { padding: 0 16px; }

/* ドラクエ風のウィンドウ */
.win {
  background: var(--win);
  border: 2px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--bg), 0 0 0 4px #39405a;
  padding: 12px;
  margin: 10px 0 14px;
}
.win h2 { margin: 0 0 8px; font-size: 15px; color: var(--gold); }
.note { font-size: 14px; color: var(--dim); }
.note strong { color: var(--text); }
.small { font-size: 13px; color: var(--dim); }

input[type=search], select, textarea {
  width: 100%; background: #070a15; border: 1px solid #4a5270; border-radius: 8px;
  padding: 10px 12px; font-size: 16px;
}
select { margin-top: 8px; appearance: none; }
textarea { margin: 8px 0; }

.chips { display: flex; gap: 6px; margin-top: 8px; overflow-x: auto; }
.chips button {
  flex: none; background: transparent; border: 1px solid #4a5270; border-radius: 999px;
  padding: 5px 12px; font-size: 13px; color: var(--dim);
}
.chips button.on { border-color: var(--gold); color: var(--gold); }

.list { list-style: none; padding: 0; margin: 0; }
.mon {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid #222a44;
}
.mon .main { flex: 1; min-width: 0; }
.mon .name { font-weight: 600; }
.mon .meta { font-size: 12px; color: var(--dim); }
.own {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  border: 2px solid #4a5270; background: transparent; font-size: 18px; line-height: 1;
}
.own.on { border-color: var(--ok); background: var(--ok); color: #062012; }

.badge {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  border: 1px solid currentColor; margin-left: 4px; white-space: nowrap; vertical-align: 1px;
}
.b-owned { color: var(--ok); }
.b-ready { color: var(--ready); }
.b-steps { color: var(--gold); }
.b-scout { color: var(--warn); }
.b-none { color: #6b7391; }
.b-ref { color: #c79bff; }

.group-h { margin: 18px 0 4px; font-size: 14px; color: var(--gold); }

/* 下のタブ */
.bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; background: #070a15; border-top: 2px solid var(--line);
  padding-bottom: var(--bot);
}
.bottom button {
  flex: 1; background: none; border: 0; padding: 8px 0 10px; font-size: 12px; color: var(--dim);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.bottom button span { font-size: 20px; filter: grayscale(1) opacity(.6); }
.bottom button.on { color: var(--gold); }
.bottom button.on span { filter: none; }

.btns { display: flex; gap: 8px; margin-top: 8px; }
.btns button, .danger, .act {
  flex: 1; background: #1c2440; border: 1px solid var(--line); border-radius: 8px; padding: 10px;
}
.danger { width: 100%; margin-top: 4px; border-color: var(--danger); color: var(--danger); background: transparent; }
.row { display: flex; align-items: center; gap: 8px; }
.row input { width: 20px; height: 20px; }

/* 詳細シート */
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet-body {
  position: absolute; left: 8px; right: 8px; bottom: calc(8px + var(--bot));
  max-height: calc(100% - 40px - var(--top)); overflow-y: auto; margin: 0;
  -webkit-overflow-scrolling: touch;
}
.close {
  position: sticky; top: 0; float: right; width: 36px; height: 36px; border-radius: 50%;
  background: #1c2440; border: 1px solid var(--line); font-size: 20px; line-height: 1;
}
.detail h2 { font-size: 20px; margin: 4px 0 2px; color: var(--text); }
.detail h3 { font-size: 14px; color: var(--gold); margin: 16px 0 6px; }
.act { width: 100%; margin-top: 10px; }
.act.on { background: var(--ok); color: #062012; border-color: var(--ok); font-weight: 700; }

.steps { margin: 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 6px 0 6px 30px; border-bottom: 1px dashed #2a3352; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 7px;
  width: 22px; height: 22px; border-radius: 50%; background: #1c2440; border: 1px solid #4a5270;
  font-size: 12px; text-align: center; line-height: 20px;
}
.steps .kind { font-size: 12px; color: var(--dim); }
.link { color: var(--ready); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.recipe { padding: 6px 0; border-bottom: 1px dashed #2a3352; font-size: 15px; }
.have { color: var(--ok); }
.empty { color: var(--dim); font-size: 14px; padding: 8px 0; }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + var(--bot)); transform: translateX(-50%);
  background: #1c2440; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px;
  font-size: 14px; z-index: 30;
}
