/* らぁめん壱杯 — site styles
   Layout: one centered column (max 1120px); black lacquer ground, vermilion for action, gold for victory. */
:root {
  color-scheme: dark;
  --ground: #0a0706;
  --lacquer: #15100d;
  --lacquer-2: #1d1612;
  --rule: #3a2b21;
  --ink: #f6f0e4;
  --muted: #b4a998;
  --faint: #7d7266;
  --red: #d8261c;
  --red-deep: #8f130d;
  --gold: #e7b257;
  --gold-soft: #f6d792;
  --ok: #73d394;
  --ng: #ff6b5d;
  --f-display: "Shippori Mincho B1", "Yu Mincho", "Hiragino Mincho ProN", serif;
  --f-body: "Zen Kaku Gothic New", "Yu Gothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
  --f-num: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --radius: 6px;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--f-body); font-size: 1rem; line-height: 1.8;
  background-image:
    radial-gradient(1200px 600px at 100% -10%, rgba(216, 38, 28, .13), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(231, 178, 87, .06), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh; display: flex; flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold-soft); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--f-display); line-height: 1.35; margin: 0; text-wrap: balance; }
p { margin: 0; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }
.eyebrow { font-family: var(--f-num); font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-size: .8rem; }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header */
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(10, 7, 6, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); background: var(--ground); z-index: 21; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; min-height: 64px; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 40px; width: auto; }
.nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--muted); text-decoration: none; font-weight: 700; font-size: .9rem; padding: 8px 12px; border-bottom: 2px solid transparent; white-space: nowrap; }
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); border-color: var(--red); }
.nav a.cta { color: #fff; background: var(--red); border-radius: var(--radius); border: 0; margin-left: 6px; }
.nav a.cta:hover { background: #ea3328; }
@media (max-width: 760px) {
  .site-header .wrap { flex-direction: column; align-items: stretch; gap: 0; padding-top: 8px; }
  .brand img { height: 34px; }
  .nav { margin-left: 0; flex-wrap: wrap; gap: 2px 4px; padding-bottom: 6px; overflow: visible; }
  .nav a { padding: 6px 8px; font-size: .85rem; }
  .nav a.cta { margin-left: 0; }
}

main { flex: 1; padding-bottom: 72px; }
.page-head { padding-block: 48px 28px; display: flex; flex-direction: column; gap: 8px; }
.page-head h1 { font-size: clamp(1.8rem, 1.3rem + 2.2vw, 2.8rem); font-weight: 800; }
.page-head p { color: var(--muted); max-width: 62ch; }

.site-footer { border-top: 1px solid var(--rule); padding-block: 28px 36px; color: var(--muted); font-size: .85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; justify-content: space-between; }
.site-footer img { height: 46px; width: auto; }
.site-footer .copy { font-family: var(--f-display); color: var(--gold-soft); font-size: 1rem; }

/* ---------- buttons, chips */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 700; font-size: .95rem; padding: 10px 20px; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; text-decoration: none; line-height: 1.4; white-space: nowrap; }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: #ea3328; }
.btn-gold { background: var(--gold); color: #1a0f05; }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { border-color: var(--gold); }
.btn-danger { background: transparent; color: var(--ng); border-color: rgba(255, 107, 93, .45); }
.btn-danger:hover { background: rgba(255, 107, 93, .1); }
.btn-sm { padding: 6px 12px; font-size: .82rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap; }
.chip-red { color: #fff; background: var(--red); border-color: var(--red); }
.chip-gold { color: var(--gold-soft); border-color: rgba(231, 178, 87, .55); }
.chip-live { color: #fff; background: var(--red); border-color: var(--red); letter-spacing: .1em; font-family: var(--f-num); }
.chip-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; }

/* ---------- panels */
.panel { background: var(--lacquer); border: 1px solid var(--rule); border-radius: var(--radius); padding: 22px; }
.section { margin-top: 56px; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 10px; margin-bottom: 18px; }
.section-head h2 { font-size: clamp(1.35rem, 1.15rem + .9vw, 1.75rem); font-weight: 800; }
.notice { border-left: 3px solid var(--gold); background: #211710; color: var(--gold-soft); padding: 12px 16px; border-radius: 0 var(--radius) var(--radius) 0; white-space: pre-line; }
.empty { text-align: center; color: var(--muted); border: 1px dashed var(--rule); border-radius: var(--radius); padding: 36px 16px; }

/* ---------- hero (top page) */
.hero { position: relative; border-bottom: 1px solid var(--rule); background: #050303; }
.hero img { width: 100%; max-height: 640px; object-fit: cover; object-position: 50% 50%; }
.hero-copy { padding-block: 26px 0; display: flex; flex-direction: column; gap: 6px; }
.hero-copy .tagline { font-family: var(--f-display); font-weight: 800; font-size: clamp(1.4rem, 1rem + 2vw, 2.3rem); color: var(--gold-soft); letter-spacing: .08em; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--lacquer); margin-top: 28px; }
.stat { padding: 16px 18px; border-left: 1px solid var(--rule); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat dt { font-size: .78rem; color: var(--muted); }
.stat dd { margin: 2px 0 0; font-weight: 700; font-size: 1.05rem; }
.stat dd .num { font-family: var(--f-num); font-size: 1.6rem; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* ---------- featured matches */
.match-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.match-tile { background: var(--lacquer); border: 1px solid var(--rule); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.match-tile .meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-family: var(--f-num); letter-spacing: .08em; color: var(--muted); font-size: .85rem; }
.match-tile .vs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 10px; font-weight: 700; }
.match-tile .vs span:last-child { text-align: right; }
.match-tile .vs em { font-style: normal; font-family: var(--f-num); color: var(--gold); font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.tbd { color: var(--faint); font-weight: 500; }

/* ---------- teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.team-card { background: var(--lacquer); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.team-card h3 { font-size: 1.35rem; overflow-wrap: anywhere; }
.team-card .kana { color: var(--muted); font-size: .82rem; }
.roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.roster li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: baseline; border-top: 1px solid var(--rule); padding-top: 6px; }
.roster .no { font-family: var(--f-num); font-weight: 700; color: var(--red); }
.roster .rs { color: var(--gold); font-size: .72rem; font-weight: 700; }
.roster small { color: var(--muted); margin-left: 6px; font-size: .78rem; }
.team-card blockquote { margin: 0; padding: 10px 14px; background: var(--lacquer-2); border-radius: var(--radius); color: #e6dccb; font-size: .92rem; overflow-wrap: anywhere; white-space: pre-line; }

/* ---------- bracket */
.bracket-scroll { overflow-x: auto; padding-bottom: 12px; }
.bracket { display: grid; gap: 0; min-width: max-content; }
.b-round-title { font-family: var(--f-num); font-weight: 700; letter-spacing: .14em; color: var(--gold); font-size: .85rem; padding: 0 0 10px; text-align: left; }
.b-match { align-self: center; width: 230px; margin: 8px 0; background: var(--lacquer); border: 1px solid var(--rule); border-radius: var(--radius); position: relative; text-align: left; font: inherit; color: inherit; padding: 0; cursor: pointer; }
.b-match:hover { border-color: var(--gold); }
.b-match.is-featured { border-color: rgba(231, 178, 87, .7); }
.b-match.is-live { border-color: var(--red); box-shadow: 0 0 0 1px var(--red), 0 0 22px rgba(216, 38, 28, .35); }
.b-match .b-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 5px 10px; border-bottom: 1px solid var(--rule); font-size: .7rem; color: var(--muted); font-family: var(--f-num); letter-spacing: .08em; min-height: 28px; }
.b-team { display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; gap: 6px; padding: 6px 10px; font-size: .9rem; }
.b-team + .b-team { border-top: 1px solid #2a1f18; }
/* long team names wrap instead of being cut off (the match box grows; the bracket grid rows are auto-height) */
.b-team .n { overflow-wrap: anywhere; line-height: 1.3; }
.b-team .s { font-family: var(--f-num); font-weight: 700; font-size: 1.1rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.b-team.win .n { color: var(--gold-soft); font-weight: 700; }
.b-team.win .s { color: var(--gold-soft); }
.b-team.lose .n { color: var(--faint); }
.b-match.is-empty { opacity: .35; cursor: default; }
.b-conn { position: relative; width: 36px; }
.b-conn::before { content: ""; position: absolute; left: 0; width: 50%; top: 25%; bottom: 25%; border: 1px solid var(--rule); border-left: 0; }
.b-conn::after { content: ""; position: absolute; left: 50%; right: 0; top: 50%; border-top: 1px solid var(--rule); }
.champion-box { align-self: center; margin-left: 16px; width: 220px; text-align: center; padding: 18px; border: 1px solid rgba(231, 178, 87, .55); border-radius: var(--radius); background: linear-gradient(180deg, #2a1d0f, var(--lacquer)); }
.champion-box .eyebrow { display: block; }
.champion-box strong { display: block; font-family: var(--f-display); font-size: 1.3rem; color: var(--gold-soft); margin-top: 6px; overflow-wrap: anywhere; }

/* ---------- dialog */
dialog { background: var(--lacquer); color: var(--ink); border: 1px solid var(--rule); border-radius: 10px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
dialog::backdrop { background: rgba(0, 0, 0, .7); }
.dlg-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.dlg-body { padding: 18px 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.dlg-close { background: none; border: 1px solid var(--rule); color: var(--ink); border-radius: var(--radius); width: 36px; height: 36px; font-size: 1.2rem; cursor: pointer; flex: none; }
.dlg-score { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 12px; align-items: center; text-align: center; }
.dlg-score .big { font-family: var(--f-num); font-weight: 700; font-size: 2.6rem; color: var(--gold-soft); font-variant-numeric: tabular-nums; }
.dlg-teams { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .dlg-teams { grid-template-columns: 1fr; } }

/* ---------- forms */
.form { display: flex; flex-direction: column; gap: 26px; }
fieldset { border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px 20px; margin: 0; min-width: 0; background: var(--lacquer); }
legend { font-family: var(--f-display); font-weight: 800; font-size: 1.1rem; padding: 0 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
@media (max-width: 860px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-2, .grid-4 { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field .label { font-size: .85rem; font-weight: 700; }
.field .req { color: var(--red); font-size: .72rem; margin-left: 4px; }
.field .opt { color: var(--faint); font-size: .72rem; margin-left: 4px; }
.field small { color: var(--faint); font-size: .76rem; line-height: 1.5; }
input[type="text"], input[type="password"], input[type="number"], input[type="url"], textarea, select {
  font: inherit; color: var(--ink); background: #0d0907; border: 1px solid #4a3829; border-radius: var(--radius); padding: 9px 12px; width: 100%; min-width: 0;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); outline: none; box-shadow: 0 0 0 3px rgba(231, 178, 87, .18); }
.field.has-error input, .field.has-error textarea { border-color: var(--ng); }
.err { color: var(--ng); font-size: .8rem; min-height: 0; }
.err:empty { display: none; }
.member-row { padding-top: 14px; margin-top: 14px; border-top: 1px dashed var(--rule); }
.member-row:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.member-title { font-family: var(--f-num); font-weight: 700; color: var(--red); letter-spacing: .12em; font-size: .9rem; margin-bottom: 8px; }
.toggle { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 700; }
.toggle input { width: 18px; height: 18px; accent-color: var(--red); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.status-box { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--lacquer); }
.status-box.ok { border-color: rgba(115, 211, 148, .5); color: var(--ok); }
.status-box.bad { border-color: rgba(255, 107, 93, .5); color: var(--ng); }

/* ---------- prose (rules page) */
.prose { max-width: 70ch; display: flex; flex-direction: column; gap: 12px; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 4px; }
.rule-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.rule-card { background: var(--lacquer); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px; }
.rule-card dt { font-size: .8rem; color: var(--muted); }
.rule-card dd { margin: 4px 0 0; font-family: var(--f-display); font-weight: 800; font-size: 1.35rem; }
.rule-card dd small { display: block; font-family: var(--f-body); font-weight: 500; font-size: .82rem; color: var(--muted); }

/* ---------- result report */
.step-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.step-head > span { font-family: var(--f-num); font-weight: 700; font-style: italic; color: var(--red); font-size: 2rem; line-height: 1; }
.step-head h2 { font-size: clamp(1.25rem, 1.1rem + .7vw, 1.6rem); font-weight: 800; }
.step-head p { color: var(--muted); font-size: .9rem; }
.team-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.team-picker button { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 16px; text-align: left; font: inherit; font-weight: 700; color: var(--ink); background: var(--lacquer); border: 1px solid var(--rule); border-radius: 8px; cursor: pointer; overflow-wrap: anywhere; }
.team-picker button span { font-family: var(--f-num); color: var(--muted); font-weight: 600; }
.team-picker button:hover { border-color: var(--gold); }
.team-picker button.selected { border-color: var(--red); background: #241210; box-shadow: 0 0 0 2px rgba(216, 38, 28, .3); }
.report-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: center; padding: 20px 22px; margin-bottom: 12px; background: var(--lacquer); border: 1px solid var(--rule); border-left: 4px solid var(--red); border-radius: var(--radius); }
.report-info small { font-family: var(--f-num); letter-spacing: .08em; color: var(--muted); }
.report-info h3 { font-family: var(--f-body); font-size: 1.15rem; margin-top: 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.report-info h3 em { font-style: normal; font-family: var(--f-num); color: var(--gold); font-size: .9rem; }
.my-team { background: #3a1513; border: 1px solid #7a2d28; border-radius: 4px; padding: 3px 10px; }
.report-input { display: flex; align-items: center; gap: 14px; }
.score-pair { display: flex; align-items: center; gap: 8px; }
.score-pair input { width: 64px; text-align: center; font-family: var(--f-num); font-size: 1.5rem; font-weight: 700; padding: 6px; }
.report-hint { grid-column: 1 / -1; font-size: .85rem; color: var(--ok); }
.report-hint.bad { color: var(--ng); }
@media (max-width: 640px) { .report-card { grid-template-columns: 1fr; } .report-input { justify-content: space-between; } }

/* ---------- toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 50; background: #241a12; color: var(--gold-soft); border: 1px solid var(--gold); padding: 10px 18px; border-radius: var(--radius); max-width: calc(100vw - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.bad { color: var(--ng); border-color: var(--ng); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* past tournaments (/archive) */
.archive-list { display: grid; gap: 14px; }
.archive-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: center; padding: 22px 24px; background: var(--lacquer); border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: var(--radius); }
.archive-card h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.65rem); font-weight: 800; margin: 4px 0 6px; overflow-wrap: anywhere; }
.archive-card h2 a { color: var(--ink); text-decoration: none; }
.archive-card h2 a:hover { color: var(--gold-soft); }
.ac-champ { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; }
.ac-champ .lbl { font-size: .78rem; font-weight: 700; color: #1a1006; background: var(--gold); padding: 1px 10px; border-radius: 999px; }
.ac-champ strong { font-family: var(--f-display); font-size: 1.2rem; color: var(--gold-soft); overflow-wrap: anywhere; }
.ac-actions { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.archive-hero { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: stretch; }
.archive-hero .champion-box { margin: 0; width: auto; display: flex; flex-direction: column; justify-content: center; }
.archive-hero .champion-box strong { font-size: 1.6rem; }
.ah-side { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 14px; padding: 18px 22px; background: var(--lacquer); border: 1px solid var(--rule); border-radius: var(--radius); }
.ah-facts { display: grid; gap: 6px; margin: 0; }
.ah-facts div { display: flex; gap: 14px; }
.ah-facts dt { flex: none; width: 3em; color: var(--muted); font-size: .88rem; }
.ah-facts dd { margin: 0; overflow-wrap: anywhere; }
.team-card.is-champion { border-color: rgba(231, 178, 87, .7); box-shadow: 0 0 0 1px rgba(231, 178, 87, .35); }
@media (max-width: 640px) { .archive-card, .archive-hero { grid-template-columns: 1fr; } .ac-actions { flex-direction: row; flex-wrap: wrap; } }
