:root {
  --bg: #f3f4f7;
  --card: #fff;
  --text: #1d2433;
  --muted: #6b7385;
  --line: #dde1e8;
  --primary: #1f2a44;
  --accent: #e2574c;
  --ok: #1f8a5b;
  --err: #c0392b;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px; line-height: 1.6;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: #2557c7; }
h1, h2, h3 { line-height: 1.3; }
h2 { font-size: 1.1rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .6rem;
  background: var(--primary); color: #fff;
  padding: .6rem 1rem; padding-top: calc(.6rem + env(safe-area-inset-top));
}
.topbar a { color: #fff; text-decoration: none; }
.topbar .brand { font-weight: 700; letter-spacing: .05em; }
.topbar .back { font-size: 1.8rem; line-height: 1; padding: 0 .4rem 0 0; }
.topbar .who { margin-left: auto; font-size: .85rem; opacity: .85; }

.wrap { max-width: 860px; margin: 0 auto; padding: 1rem; }
.page-title { font-size: 1.35rem; margin: .4rem 0 1rem; }

.card { background: var(--card); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; box-shadow: 0 1px 2px rgba(0,0,0,.05); border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.card-head h2 { margin: 0; }
.hint { border-left: 4px solid var(--accent); }
.danger summary { color: var(--err); cursor: pointer; }
details.card > summary { cursor: pointer; font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.big { font-size: 1.1rem; font-weight: 600; margin: 0 0 .5rem; }
.pre { white-space: pre-wrap; margin: .2rem 0; }
.plain { list-style: none; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .8rem; }
.flash-ok { background: #e5f5ed; color: var(--ok); }
.flash-err { background: #fdecea; color: var(--err); }

/* フォーム */
.form label, label { display: block; font-size: .85rem; color: var(--muted); margin: .6rem 0; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem;
  font: inherit; font-size: 16px; color: var(--text);
  padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fb0ff; border-color: #8fb0ff; }
input[type=radio], input[type=checkbox] { display: inline-block; width: auto; margin: 0 .4rem 0 0; }
label.radio, label.check { color: var(--text); font-size: .95rem; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: .8rem 0; }
legend { font-size: .85rem; color: var(--muted); }
.choice { display: flex; align-items: flex-start; gap: .3rem; padding: .7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: .95rem; }
.choice input { margin-top: .3rem; }
.choice:has(input:checked) { border-color: var(--primary); background: #f0f3fa; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .6rem; }
.grid3 { display: grid; grid-template-columns: 1.2fr 1.2fr .6fr; gap: 0 .6rem; }
.grid2 label, .grid3 label { margin: .3rem 0; }
.inline-form { display: flex; gap: .5rem; align-items: center; margin-top: .6rem; }
.inline-form input, .inline-form select { margin: 0; flex: 1; }
form.inline { display: inline; }

/* ボタン */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: .65rem 1.1rem; border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-danger { background: var(--err); color: #fff; border-color: var(--err); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { padding: .4rem .8rem; font-size: .85rem; white-space: nowrap; }
.btn-block { display: block; width: 100%; }
.linkbtn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: .8rem; }

.sticky-save { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; padding: .6rem 0; background: linear-gradient(transparent, var(--bg) 30%); }
.sticky-save.two { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }

/* 一覧 */
.item { display: block; padding: .7rem 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.item:first-of-type { border-top: 0; }
.item-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.item-date { display: block; font-size: .8rem; color: var(--accent); font-weight: 700; }
.item-title { display: block; font-weight: 600; }
.item-sub { display: block; font-size: .8rem; color: var(--muted); }
.actions { flex-shrink: 0; }
.badge { display: inline-block; font-size: .72rem; padding: .1rem .5rem; border-radius: 999px; background: #eceff4; color: var(--muted); font-weight: 600; }
.badge-rec { background: #fff1d6; color: #9a6400; }
.badge-sound { background: #e3edff; color: #2557c7; }
.badge-lighting { background: #fff4cc; color: #8a6d00; }
.badge-stage { background: #e8f6ee; color: var(--ok); }

.times { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin: 0 0 .6rem; }
.times div { display: flex; gap: .3rem; }
.times dt { color: var(--muted); font-size: .85rem; }
.times dd { margin: 0; font-weight: 700; }

/* 行カード（曲・メンバー・機材） */
.rows { counter-reset: row; }
.row-card { border: 1px solid var(--line); border-radius: 10px; padding: .4rem .7rem .2rem; margin-bottom: .6rem; background: #fbfcfe; }
.row-tools { display: flex; align-items: center; gap: .3rem; }
.row-tools .row-no { font-weight: 700; color: var(--accent); margin-right: auto; }
.row-tools .row-no::before { counter-increment: row; content: counter(row); }
.row-tools b { margin-right: auto; }
.row-tools button { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 2.2rem; height: 2rem; cursor: pointer; }
.song .f-title input { font-weight: 700; }

.jump { position: sticky; top: calc(48px + env(safe-area-inset-top)); z-index: 6; display: flex; gap: .3rem; overflow-x: auto; background: var(--bg); padding: .4rem 0; margin-bottom: .6rem; }
.jump a { flex-shrink: 0; padding: .3rem .8rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--text); font-size: .85rem; }

section[id] { scroll-margin-top: 110px; }
.stage-preview { display: block; max-width: 100%; max-height: 420px; margin: 0 auto .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.picker { margin: .6rem 0; }
.picker summary { cursor: pointer; font-weight: 600; padding: .4rem 0; }
.pick { display: block; width: 100%; text-align: left; margin: .3rem 0; padding: .5rem .7rem; border: 1px dashed var(--line); background: #fff; border-radius: 8px; cursor: pointer; font: inherit; }
.pick.added { border-style: solid; border-color: var(--ok); color: var(--ok); }

.note { border-top: 1px solid var(--line); padding: .6rem 0; }
.note-head { font-size: .9rem; }

.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: .4rem; text-align: left; }

.slotinfo { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .4rem 0 .8rem; }
.slotinfo div { background: #f0f3fa; border-radius: 8px; padding: .4rem .5rem; text-align: center; }
.slotinfo span { display: block; font-size: .72rem; color: var(--muted); }
.slotinfo b { font-size: .95rem; }
.slotinfo p { grid-column: 1 / -1; margin: 0; }
#total-time.over { color: var(--err); font-weight: 700; }

/* 広告（PR） */
.ad { margin: 0 0 1rem; }
.ad-inner { position: relative; display: flex; gap: .7rem; align-items: center; padding: .7rem .8rem; background: #fffdf5; border: 1px dashed #e0c98a; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.ad-pr { position: absolute; top: .35rem; right: .5rem; font-size: .65rem; font-weight: 700; color: #9a6400; border: 1px solid #e0c98a; border-radius: 4px; padding: 0 .3rem; background: #fff; }
.ad-img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #fff; }
.ad-text { display: flex; flex-direction: column; min-width: 0; padding-right: 1.6rem; }
.ad-text b { font-size: .95rem; line-height: 1.35; }
.ad-text span { font-size: .85rem; color: var(--muted); }
.ad-text small { font-size: .72rem; color: var(--muted); }

/* 提供元 */
.sitefoot { text-align: center; font-size: .75rem; color: var(--muted); padding: .5rem 1rem 1.2rem; }
.sitefoot a { color: var(--muted); }

/* 下のナビ */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a { text-align: center; padding: .45rem 0 .35rem; text-decoration: none; color: var(--text); font-size: 1.15rem; line-height: 1.1; }
.bottomnav span { display: block; font-size: .7rem; color: var(--muted); margin-top: .15rem; }

/* PC では曲を横並びに */
@media (min-width: 760px) {
  .songs .row-card { display: grid; grid-template-columns: 2.2rem 2fr 1.1fr 2fr; gap: 0 .6rem; align-items: start; }
  .songs .row-tools { grid-row: span 3; flex-direction: column; }
  .songs .row-tools .row-no { margin: 0 0 .3rem; }
}
