:root {
  font-family: Inter, "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f7fb;
  background: #08090d;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at top right, #211218 0, #0b0d12 28%, #08090d 70%); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { width: min(1480px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 80px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: end; padding: 28px 0 34px; }
.hero h1 { font-size: clamp(32px, 5vw, 68px); line-height: .95; letter-spacing: -.05em; margin: 8px 0 14px; }
.hero p { margin: 0; color: #9299a8; }
.eyebrow { color: #ff4655; font-size: 11px; letter-spacing: .24em; font-weight: 800; }
.panel { display: grid; grid-template-columns: 74px 1fr; border: 1px solid #272a33; background: rgba(13, 15, 20, .94); margin-bottom: 18px; }
.panel-index { font-size: 15px; color: #ff4655; border-right: 1px solid #272a33; padding: 28px 24px; font-weight: 800; }
.panel-body { padding: 28px; min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 22px; }
.section-heading.compact { margin-bottom: 14px; }
h2, h3, p { margin-top: 0; }
h2 { margin-bottom: 0; font-size: 26px; }
h3 { margin-bottom: 7px; }
p { color: #8f96a6; }
.primary, .secondary, .ghost, .tab, .icon-button { border: 1px solid #343844; border-radius: 3px; color: #f5f7fb; background: #151821; padding: 11px 16px; transition: .15s ease; }
.primary { background: #ff4655; border-color: #ff4655; color: white; font-weight: 800; }
.secondary { background: #20242d; font-weight: 700; }
.ghost { background: transparent; }
.danger { color: #ff7c87; }
button:hover { transform: translateY(-1px); border-color: #666e7d; }
.primary:hover { border-color: #ff6c78; }
input, select, textarea { width: 100%; border: 1px solid #343844; background: #0e1117; color: #f5f7fb; border-radius: 3px; padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #ff4655; box-shadow: 0 0 0 2px rgba(255, 70, 85, .12); }
textarea { resize: vertical; min-height: 140px; }
label { display: grid; gap: 7px; color: #b9bfcb; font-size: 13px; }
.tournament-tabs, .group-tabs, .team-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tournament-tabs { margin-bottom: 18px; }
.tab { padding: 8px 12px; }
.tab.active { border-color: #ff4655; color: #fff; box-shadow: inset 0 -2px 0 #ff4655; }
.inline-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: end; }
.group-box { margin-top: 26px; border-top: 1px solid #272a33; padding-top: 22px; }
.group-create { grid-template-columns: minmax(0, 380px) auto; justify-content: start; margin-bottom: 14px; }
.group-tabs { margin-top: 6px; }
.section-heading h3 span { font-size: 11px; color: #8c93a2; border: 1px solid #333844; padding: 2px 6px; margin-left: 7px; }
.scope-badge { border: 1px solid #363b48; padding: 7px 10px; color: #c7ccd6; font-size: 12px; }
.scoring-grid { display: grid; grid-template-columns: 1.2fr 1.2fr .9fr; gap: 14px; }
.setting-card { border: 1px solid #282c36; background: #10131a; padding: 18px; }
.setting-card p { font-size: 13px; min-height: 38px; }
.triple-input { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.number-unit { display: grid; grid-template-columns: 1fr auto; align-items: center; border: 1px solid #343844; background: #0e1117; }
.number-unit input { border: 0; background: transparent; }
.number-unit b { padding-right: 10px; color: #7e8594; font-size: 11px; }
.toggle-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; border-top: 1px solid #282c36; padding: 12px 0; }
.toggle-row input { width: 18px; height: 18px; accent-color: #ff4655; }
.toggle-row span { display: grid; gap: 3px; }
.toggle-row small { color: #7d8491; }
.formula-strip, .league-strip, .ranking-rule { border: 1px solid #2d3240; background: #11151d; padding: 13px 15px; margin-top: 14px; color: #b8bfcc; }
.formula-strip { color: #f0f2f6; font-weight: 700; }
.team-editor { display: grid; grid-template-columns: minmax(190px, .65fr) minmax(260px, 1fr) auto; gap: 16px; align-items: start; border-top: 1px solid #272a33; margin-top: 22px; padding-top: 22px; }
.team-editor .team-chips { grid-column: 2 / -1; }
.team-chips span { border: 1px solid #303541; background: #141821; padding: 6px 9px; font-size: 12px; }
.league-strip { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 14px; align-items: center; margin: 0 0 16px; }
.match-list { display: grid; gap: 9px; }
.match-row { display: grid; grid-template-columns: 54px minmax(150px, 1fr) 74px 24px 74px minmax(150px, 1fr) 42px; gap: 8px; align-items: center; border: 1px solid #292e38; background: #0f1218; padding: 10px; position: relative; }
.match-row.warning { border-color: #b2742a; margin-bottom: 30px; }
.match-no { color: #7f8796; font-size: 12px; font-weight: 800; }
.score { text-align: center; font-weight: 800; }
.dash { text-align: center; color: #727987; }
.icon-button { padding: 8px 10px; }
.match-warning { position: absolute; top: calc(100% + 6px); left: 64px; color: #ffba68; font-size: 12px; }
.button-row { display: flex; gap: 10px; margin-top: 16px; }
.standings-shell { margin-top: 34px; }
.export-card { background: #0d0f14; border: 1px solid #2d313b; padding: 30px; width: 100%; }
.export-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; border-bottom: 1px solid #292d36; padding-bottom: 20px; }
.export-head h2 { font-size: 30px; margin-top: 7px; }
.export-head h3 { margin: 5px 0 0; color: #aeb4c0; font-size: 16px; }
.export-meta { display: grid; gap: 5px; text-align: right; }
.export-meta strong { color: #ff4655; }
.export-meta span { color: #8e95a3; }
.ranking-rule { margin: 14px 0; font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { border-bottom: 1px solid #252a33; padding: 12px 10px; text-align: center; white-space: nowrap; }
th { color: #777f8e; font-size: 11px; letter-spacing: .05em; }
td { color: #cbd0d9; }
.team-name { text-align: left; color: white; font-weight: 800; }
.rank { color: #ff4655; font-weight: 900; }
.total { color: white; font-weight: 900; }
.empty { color: #747b89; padding: 34px; }
.export-foot { display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; color: #777f8e; font-size: 11px; margin-top: 18px; }
.export-button { margin-top: 14px; float: right; }
@media (max-width: 980px) {
  .scoring-grid { grid-template-columns: 1fr; }
  .team-editor { grid-template-columns: 1fr; }
  .team-editor .team-chips { grid-column: auto; }
  .league-strip { grid-template-columns: 1fr 1fr; }
  .match-row { grid-template-columns: 42px 1fr 62px 18px 62px 1fr 38px; }
}
@media (max-width: 720px) {
  .app-shell { width: min(100% - 18px, 1480px); padding-top: 18px; }
  .hero { align-items: stretch; flex-direction: column; }
  .panel { grid-template-columns: 1fr; }
  .panel-index { border-right: 0; border-bottom: 1px solid #272a33; padding: 12px 18px; }
  .panel-body { padding: 18px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .inline-grid, .group-create { grid-template-columns: 1fr; }
  .triple-input { grid-template-columns: 1fr; }
  .league-strip { grid-template-columns: 1fr; }
  .match-row { grid-template-columns: 42px 1fr 58px 18px 58px; }
  .match-row select:last-of-type { grid-column: 2 / 5; }
  .match-row .icon-button { grid-column: 5; grid-row: 2; }
  .match-warning { left: 10px; }
  .export-card { padding: 18px; }
  .export-head { align-items: flex-start; flex-direction: column; }
  .export-meta { text-align: left; }
}

.storage-panel { display: flex; justify-content: space-between; gap: 22px; align-items: center; border: 1px solid #2a2f3a; background: rgba(15, 18, 24, .96); padding: 20px 22px; margin-bottom: 18px; }
.storage-copy { min-width: 0; }
.storage-copy h2 { margin: 5px 0 7px; }
.storage-copy p { margin-bottom: 10px; font-size: 13px; }
.storage-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.storage-badge { border: 1px solid #4b5363; background: #151922; color: #c4cad5; font-size: 11px; font-weight: 800; padding: 5px 8px; }
.storage-badge.shared { border-color: #ff4655; color: #fff; }
.storage-meta { display: flex; gap: 18px; flex-wrap: wrap; color: #8991a0; font-size: 12px; }
.storage-meta strong { color: #d9dee7; margin-left: 5px; }
.storage-actions { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.conflict-banner { display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid #a86d29; background: #21170c; padding: 16px 18px; margin-bottom: 18px; }
.conflict-banner div { display: grid; gap: 4px; }
.conflict-banner strong { color: #ffbd6d; }
.conflict-banner span { color: #c4a77f; font-size: 13px; }
.modal { border: 0; padding: 0; background: transparent; color: #f5f7fb; width: min(560px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.modal-card { display: grid; gap: 15px; border: 1px solid #343945; background: #0d1016; padding: 24px; box-shadow: 0 24px 80px rgba(0,0,0,.45); }
.modal-card h2 { margin: 0; }
.modal-card p { margin: 0; font-size: 13px; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.modal-note { border: 1px solid #2c313c; background: #12161e; color: #949cab; padding: 11px 12px; font-size: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }
.form-error { color: #ff9ca5; border: 1px solid #6a3339; background: #211013; padding: 10px 12px; font-size: 12px; }
@media (max-width: 720px) {
  .storage-panel { align-items: stretch; flex-direction: column; }
  .storage-actions { justify-content: stretch; }
  .storage-actions button { flex: 1; }
  .conflict-banner { align-items: stretch; flex-direction: column; }
  .copy-row { grid-template-columns: 1fr; }
}
