:root {
  --bg: #06140d;
  --bg2: #0a2014;
  --panel: #0e2418;
  --panel2: #112b1c;
  --line: #1f3d2c;
  --gold: #e7c469;
  --gold-bright: #f8e6a6;
  --gold-deep: #b3902f;
  --fg: #f1ece0;
  --muted: #8ba596;
  --pitch: #36a96a;
  --danger: #f08a7a;
  --grad-gold: linear-gradient(135deg, #f8e6a6, #e7c469 45%, #b3902f);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(1200px 500px at 50% -120px, #103021 0%, transparent 70%),
    var(--bg);
  color: var(--fg);
  font-family: "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}
.glow { position: fixed; inset: 0 0 auto 0; height: 280px; pointer-events: none; z-index: 0;
  background: radial-gradient(600px 220px at 50% 0, rgba(231,196,105,.10), transparent 70%); }

/* ---- header ---- */
header {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; }
.trophy { font-size: 22px; filter: drop-shadow(0 0 8px rgba(231,196,105,.5)); }
.brandtext {
  font-family: "Cinzel", "Noto Sans JP", serif; font-weight: 800; font-size: 19px;
  letter-spacing: .03em;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brandtext em { font-style: normal; font-weight: 700; }
#userbar { font-size: 13px; color: var(--muted); text-align: right; }
#userbar a { color: var(--muted); }

/* ---- prize plinth (signature) ---- */
.plinth {
  position: relative; z-index: 1;
  max-width: 720px; margin: 22px auto 6px; padding: 22px 18px 20px; text-align: center;
  background:
    linear-gradient(180deg, rgba(231,196,105,.06), transparent 60%),
    var(--panel);
  border: 1px solid var(--gold-deep);
  border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(231,196,105,.08) inset, 0 18px 50px -28px rgba(231,196,105,.5);
}
.plinth::before, .plinth::after {
  content: ""; position: absolute; left: 18px; right: 18px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-deep), transparent);
}
.plinth::before { top: 54px; } .plinth::after { bottom: 50px; }
.pot-label { font-family: "Cinzel", "Noto Sans JP", serif; font-weight: 600;
  font-size: 12px; letter-spacing: .22em; color: var(--gold); }
.pot-value {
  font-family: "Cinzel", serif; font-weight: 900; font-size: 60px; line-height: 1.05;
  margin: 8px 0 4px;
  background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 40px rgba(231,196,105,.25);
}
.pot-value small { font-family: "Noto Sans JP"; font-size: 18px; font-weight: 700; color: var(--muted);
  -webkit-text-fill-color: var(--muted); margin-left: 6px; }
.pot-sub { font-size: 12px; color: var(--muted); }

/* ---- tabs ---- */
nav#tabs { position: relative; z-index: 1;
  display: flex; gap: 2px; max-width: 720px; margin: 14px auto 0; padding: 0 14px; }
nav#tabs button {
  flex: 1; background: transparent; color: var(--muted); border: none;
  border-bottom: 2px solid transparent; padding: 12px 6px; cursor: pointer;
  font-family: "Noto Sans JP"; font-size: 14px; font-weight: 700;
}
nav#tabs button.active { color: var(--gold-bright); border-bottom-color: var(--gold); }

main { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; padding: 16px; }
footer { position: relative; z-index: 1; max-width: 720px; margin: 30px auto; padding: 0 16px; color: #5d7567; }

/* ---- cards ---- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
h2 { font-family: "Cinzel", "Noto Sans JP", serif; font-weight: 800; font-size: 17px; margin: 0 0 14px; color: var(--gold-bright); letter-spacing: .02em; }
.muted { color: var(--muted); font-size: 13px; }

/* ---- betting slip ---- */
.slip { background:
    repeating-linear-gradient(180deg, transparent, transparent 38px, rgba(255,255,255,.015) 38px, rgba(255,255,255,.015) 39px),
    var(--panel2);
  border: 1px dashed var(--gold-deep); border-radius: 14px; padding: 16px 16px 18px; }
.pickrow { display: flex; align-items: center; gap: 10px; margin: 9px 0; }
.badge {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-family: "Cinzel", serif; font-weight: 800; font-size: 15px;
  background: var(--grad-gold); color: #2a1d00;
}
.badge.silver { background: linear-gradient(135deg,#e9eef3,#aeb9c6 60%,#7d8896); color:#1a2733; }
.badge.bronze { background: linear-gradient(135deg,#e7b98c,#c87f49 60%,#8f5424); color:#2a1400; }
.pickrow select {
  flex: 1; padding: 11px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: #0a1c12; color: var(--fg); font-size: 16px; font-family: "Noto Sans JP";
}
.stake { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.stepper { display: flex; align-items: center; gap: 0; }
.stepper button {
  width: 40px; height: 40px; border: 1px solid var(--gold-deep); background: #0a1c12; color: var(--gold-bright);
  font-size: 22px; cursor: pointer; line-height: 1;
}
.stepper button:first-child { border-radius: 10px 0 0 10px; }
.stepper button:last-child { border-radius: 0 10px 10px 0; }
.stepper .units { min-width: 56px; text-align: center; border-top: 1px solid var(--gold-deep); border-bottom: 1px solid var(--gold-deep);
  height: 40px; line-height: 40px; font-family: "Cinzel", serif; font-weight: 800; font-size: 18px; background: #0a1c12; }
.stake .cost { text-align: right; }
.stake .cost .big { font-family: "Cinzel", serif; font-weight: 800; font-size: 24px; color: var(--gold-bright); }
.stake .cost small { color: var(--muted); display: block; font-size: 11px; }

button.primary {
  display: block; width: 100%; margin-top: 14px; padding: 14px;
  background: var(--grad-gold); color: #2a1d00; border: none; border-radius: 11px;
  font-family: "Noto Sans JP"; font-weight: 900; font-size: 16px; letter-spacing: .04em; cursor: pointer;
  box-shadow: 0 10px 26px -12px rgba(231,196,105,.7);
}
button.primary:disabled { filter: grayscale(.6) brightness(.7); cursor: not-allowed; box-shadow: none; }
.msg { font-size: 13px; margin-top: 10px; text-align: center; }
.msg.err { color: var(--danger); } .msg.ok { color: var(--gold-bright); }

/* ---- my tickets ---- */
.ticket { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
.ticket:first-child { border-top: none; }
.ticket .seq { font-family: "Cinzel", serif; color: var(--gold); font-weight: 800; }
.ranks { display: flex; gap: 8px; flex-wrap: wrap; font-size: 14px; flex: 1; }
.ranks .r { white-space: nowrap; } .ranks .r b { color: var(--gold); font-family: "Cinzel", serif; margin-right: 2px; }
.tkmeta { text-align: right; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tkmeta .u { color: var(--gold-bright); font-family: "Cinzel", serif; font-size: 15px; font-weight: 800; }
.pill { display: inline-block; background: #0a1c12; border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; font-size: 11px; color: var(--muted); }

/* ---- popularity bars ---- */
.row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.row .rank { font-family: "Cinzel", serif; color: var(--muted); width: 22px; text-align: right; font-weight: 800; }
.row .name { width: 150px; font-size: 14px; }
.bar { flex: 1; background: #0a1c12; border-radius: 7px; height: 24px; overflow: hidden; border: 1px solid var(--line); }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--pitch), var(--gold)); }
.row .pct { width: 48px; text-align: right; color: var(--gold-bright); font-size: 13px; font-family: "Cinzel", serif; }

/* ---- formation mark sheet ---- */
.fhead, .frow { display: grid; grid-template-columns: 1fr 38px 38px 38px 38px; align-items: center; gap: 3px; }
.fhead { position: sticky; top: 0; z-index: 2; padding: 6px 2px; background: var(--panel);
  border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.fhead .ph { display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-family: "Cinzel", serif; font-weight: 800; font-size: 12px; }
.ph.p1 { color: var(--gold-bright); } .ph.p2 { color: #c9d3df; } .ph.p3 { color: #e0a36a; } .ph.p4 { color: #7fb89a; }
.ph .clr { font-family: "Noto Sans JP"; font-weight: 700; font-size: 9px; color: var(--muted);
  background: #0a1c12; border: 1px solid var(--line); border-radius: 6px; padding: 1px 3px; cursor: pointer; }
.ph .clr:hover { color: var(--danger); }
.ftable { /* 入れ子スクロールなし：ページ全体でスクロール */ }
.fgroup { font-family: "Cinzel", serif; font-size: 12px; letter-spacing: .1em; color: var(--gold);
  padding: 10px 2px 4px; border-bottom: 1px solid var(--line); margin-top: 4px; }
.frow { padding: 5px 2px; border-bottom: 1px solid rgba(31,61,44,.5); }
.frow.hide, .fgroup.hide { display: none; }
.fname { display: flex; align-items: center; gap: 6px; min-width: 0; }
.fname .fmeta { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.fline1 { display: flex; align-items: center; gap: 6px; }
.fline1 .flag { font-size: 18px; line-height: 1; }
.fline1 .frank { font-family: "Cinzel", serif; font-size: 11px; color: var(--muted); }
.fname .tname { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.fmeta { cursor: pointer; }
.chev { color: var(--muted); font-size: 11px; margin-left: 5px; display: inline-block; transition: transform .15s; }
.chev.open { transform: rotate(180deg); color: var(--gold); }

/* ---- team detail (expand) ---- */
.fdetail { background: #0a1c12; border: 1px solid var(--line); border-left: 3px solid var(--gold);
  border-radius: 8px; padding: 12px 13px; margin: 2px 0 8px; }
.fdetail .dnote { color: var(--gold-bright); font-style: italic; font-size: 13px; margin-bottom: 10px; }
.fdetail .dresults { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.rchip { font-size: 11px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: #0e2418; color: var(--muted); white-space: nowrap; }
.rchip.w { border-color: #2c8a57; color: #6fd49b; }
.rchip.d { border-color: #6b6f4a; color: #d6cf8e; }
.rchip.l { border-color: #7a3b3b; color: #f0a79a; }
.drow { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; }
.drow .dk { flex: none; width: 40px; color: var(--gold); font-family: "Cinzel", "Noto Sans JP", serif; font-size: 12px; }
.drow .dv { flex: 1; color: var(--fg); }
.markbtn { flex: none; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: #0a1c12; color: var(--gold-bright); font-size: 16px; line-height: 1; cursor: pointer; padding: 0; }
.markbtn.set { border-color: var(--gold-deep); }
.rowclr { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); font-size: 10px; cursor: pointer; padding: 0; margin-left: auto; }
.rowclr:hover { color: var(--danger); }

/* ---- filter bar ---- */
.filter { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.filter .flabel { font-size: 12px; color: var(--gold); font-family: "Cinzel", "Noto Sans JP", serif; margin-right: 2px; }
.filter input.fsearch { flex: 1; min-width: 120px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #0a1c12; color: var(--fg); font-size: 14px; }
.fchip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: #0a1c12;
  color: var(--muted); cursor: pointer; font-size: 14px; }
.fchip.active { background: var(--grad-gold); color: #2a1d00; border-color: var(--gold); font-weight: 700; }
.fcell { position: relative; display: grid; place-items: center; height: 36px; cursor: pointer; }
.fcell input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.fcell span { width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--line); background: #0a1c12; transition: .12s; }
.fcell.p1 input:checked + span { background: var(--grad-gold); border-color: var(--gold); }
.fcell.p2 input:checked + span { background: linear-gradient(135deg,#e9eef3,#aeb9c6); border-color:#c9d3df; }
.fcell.p3 input:checked + span { background: linear-gradient(135deg,#e7b98c,#c87f49); border-color:#e0a36a; }
.fcell.p4 input:checked + span { background: linear-gradient(135deg,#3fae74,#2c8a57); border-color:#7fb89a; }

/* ---- fixed formation bar ---- */
#fbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  max-width: 720px; margin: 0 auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(10,28,18,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--gold-deep);
  box-shadow: 0 -12px 30px -18px rgba(0,0,0,.8); }
.fbar-info { display: flex; align-items: baseline; justify-content: space-between; font-size: 14px; color: var(--muted); }
.fbar-info .big { font-family: "Cinzel", serif; font-weight: 800; font-size: 22px; color: var(--gold-bright); }
.fbar-cost b { font-family: "Cinzel", serif; font-size: 22px; color: var(--gold-bright); }
.fbar-info .peek { font-size: 12px; color: var(--gold); text-decoration: underline; cursor: pointer; background: none; border: none; }

/* ---- combination preview ---- */
.preview { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 10px; scroll-margin-top: 76px; }
.combo { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(31,61,44,.5); font-size: 13px; }
.combo .cseq { font-family: "Cinzel", serif; color: var(--muted); width: 30px; flex: none; }
.combo .cranks { display: flex; gap: 8px; flex-wrap: wrap; }
.combo .cranks b { font-family: "Cinzel", serif; margin-right: 2px; }
.combo .cranks .c1 b { color: var(--gold); } .combo .cranks .c2 b { color: #c9d3df; }
.combo .cranks .c3 b { color: #e0a36a; } .combo .cranks .c4 b { color: #7fb89a; }
.fbar-act { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.fbar-act .stepper { flex: none; }
.fbar-act .primary { margin-top: 0; flex: 1; }
#fbar .msg { margin-top: 6px; }
main { padding-bottom: 170px; }

/* ---- login ---- */
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 14px; padding: 13px; background: #fff; color: #1f1f1f; border-radius: 11px;
  text-decoration: none; font-weight: 700; font-size: 15px; }
input[type=text] { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: #0a1c12; color: var(--fg); font-size: 16px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
