:root {
  color-scheme: light;
  --navy-950: #041b37;
  --navy-900: #07284f;
  --navy-800: #0b376a;
  --navy-100: #eaf0f7;
  --orange: #f58a23;
  --orange-dark: #dc7011;
  --ink: #132238;
  --muted: #657287;
  --line: #dfe5ec;
  --paper: #ffffff;
  --page: #f3f6f9;
  --shadow: 0 18px 55px rgba(12, 35, 66, 0.12);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--page); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(245, 138, 35, 0.08), transparent 26rem),
    var(--page);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }

body.access-locked { overflow: hidden; }

.access-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  min-height: 100dvh;
  padding: 22px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 15%, rgba(245, 138, 35, .2), transparent 25rem),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
}

.access-card {
  width: min(410px, 100%);
  padding: clamp(28px, 7vw, 44px);
  color: white;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .28);
  text-align: center;
  backdrop-filter: blur(14px);
}

.access-brand {
  width: 70px;
  height: 70px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  color: var(--orange);
  border: 2px solid rgba(255, 255, 255, .75);
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -.06em;
}

.access-card .eyebrow { color: #b9cbe0; }
.access-card h1 { margin: 6px 0 10px; font-size: clamp(1.7rem, 7vw, 2.2rem); }
.access-copy { color: #dbe7f4; font-size: .92rem; line-height: 1.5; }
.access-form { margin-top: 24px; }
.access-form label { display: block; margin-bottom: 8px; color: #dbe7f4; font-size: .78rem; font-weight: 800; }
.access-form input {
  min-height: 58px;
  color: var(--navy-950);
  border: 2px solid transparent;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .55em;
  text-align: center;
  text-indent: .55em;
}
.access-form input:focus { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(245, 138, 35, .2); }
.access-form .button { width: 100%; margin-top: 4px; }
.access-error { min-height: 22px; margin: 7px 0 0; color: #ffd1c8; font-size: .8rem; font-weight: 750; }
.itebre-credit { margin-top: 24px; color: #b9cbe0; font-size: .72rem; letter-spacing: .04em; }
.itebre-credit strong { color: white; font-weight: 900; }
.access-card.shake { animation: access-shake .28s ease; }

@keyframes access-shake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-8px); }
  70% { transform: translateX(8px); }
}

.topbar {
  min-height: 78px;
  padding: 12px max(20px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  gap: 14px;
  color: white;
  background: linear-gradient(110deg, var(--navy-950), var(--navy-800));
  border-bottom: 4px solid var(--orange);
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 50%;
  color: var(--orange);
  font-weight: 900;
  letter-spacing: -.06em;
}

.topbar h1, .topbar p, h2, p { margin: 0; }
.topbar h1 { font-size: clamp(1.08rem, 2vw, 1.35rem); }
.eyebrow { margin-bottom: 2px !important; color: #b9cbe0; font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; }
.save-state { margin-left: auto; padding: 6px 10px; border-radius: 99px; background: rgba(255,255,255,.1); color: #dbe7f4; font-size: .76rem; }
.lock-button { margin-left: auto; padding: 7px 10px; color: #dbe7f4; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 99px; font-size: .76rem; font-weight: 800; }
.lock-button:hover { color: white; background: rgba(255,255,255,.18); }
.lock-button + .save-state { margin-left: 0; }

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 20px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(410px, .72fr);
  gap: 26px;
  align-items: start;
}

.editor-panel, .preview-panel {
  background: var(--paper);
  border: 1px solid rgba(12, 42, 77, .08);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.editor-panel { padding: clamp(20px, 3vw, 34px); }
.preview-panel { position: sticky; top: 18px; padding: 22px; }

.intro, .matches-heading, .preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-kicker { margin-bottom: 5px; color: var(--orange-dark); font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h2 { color: var(--navy-950); font-size: clamp(1.2rem, 2.4vw, 1.62rem); letter-spacing: -.025em; }

.weekend-fields {
  margin-top: 26px;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  background: var(--navy-100);
  border-radius: 16px;
}

label > span, legend { display: block; margin-bottom: 7px; color: #445268; font-size: .78rem; font-weight: 750; }
input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--ink);
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input:focus { border-color: var(--navy-800); box-shadow: 0 0 0 3px rgba(11, 55, 106, .12); }

.match-form { margin-top: 26px; padding-top: 26px; border-top: 1px solid var(--line); }
fieldset { margin: 0; padding: 0; border: 0; }
.poster-mode, .location-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.poster-mode { margin-top: 18px; padding: 18px; background: #fff8f0; border: 1px solid #f7d7b7; border-radius: 16px; }
.poster-mode legend, .location-switch legend { grid-column: 1 / -1; }
.poster-mode label, .location-switch label { position: relative; }
.poster-mode input, .location-switch input { position: absolute; opacity: 0; pointer-events: none; }
.poster-mode label > span {
  min-height: 72px;
  margin: 0;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: var(--navy-800);
  background: white;
  border: 1px solid #e7c7a7;
  border-radius: 12px;
  transition: .16s ease;
}
.poster-mode label > span strong { font-size: .9rem; }
.poster-mode label > span small { margin-top: 3px; color: var(--muted); font-size: .7rem; line-height: 1.3; }
.poster-mode input:checked + span { color: white; background: var(--navy-800); border-color: var(--navy-800); box-shadow: 0 8px 20px rgba(11,55,106,.18); }
.poster-mode input:checked + span small { color: #dbe7f4; }
.location-switch label > span {
  min-height: 56px;
  margin: 0;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--navy-800);
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: .92rem;
  transition: .16s ease;
}
.location-switch input:checked + span { color: white; background: var(--navy-800); border-color: var(--navy-800); box-shadow: 0 8px 20px rgba(11,55,106,.18); }

.mini-icon { width: 23px; height: 23px; display: inline-block; position: relative; }
.house-icon::before { content: "⌂"; position: absolute; inset: -6px 0 0; font-size: 30px; font-style: normal; line-height: 1; }
.bus-icon::before { content: "▣"; position: absolute; inset: 0; border: 2px solid currentColor; border-radius: 5px; font-style: normal; line-height: 1; }
.bus-icon::after { content: "••"; position: absolute; left: 3px; bottom: -7px; letter-spacing: 7px; font-style: normal; }

.form-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .wide { grid-column: span 1; }
.form-actions, .export-actions { margin-top: 20px; display: flex; gap: 10px; }

.button {
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 800;
  transition: transform .14s, box-shadow .14s, background .14s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--orange); box-shadow: 0 8px 18px rgba(245,138,35,.22); }
.button-primary:hover { background: var(--orange-dark); }
.button-secondary { color: white; background: var(--navy-800); }
.button-ghost { color: var(--navy-800); background: transparent; border-color: var(--line); }
.button.danger { color: #a43b35; font-size: .78rem; }
.hidden { display: none !important; }

.matches-section { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
.count-badge { min-width: 36px; padding: 7px 10px; color: white; background: var(--navy-800); border-radius: 99px; text-align: center; font-size: .78rem; font-weight: 850; }
.matches-list { margin-top: 16px; display: grid; gap: 10px; }
.empty-state { padding: 24px; color: var(--muted); background: #f7f9fb; border: 1px dashed #cad4df; border-radius: 13px; text-align: center; font-size: .88rem; }
.match-item { padding: 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; border: 1px solid var(--line); border-radius: 13px; }
.match-side { width: 42px; height: 42px; display: grid; place-items: center; color: white; background: var(--navy-800); border-radius: 10px; font-weight: 900; }
.match-side.away { background: var(--orange); }
.match-copy strong { display: block; color: var(--navy-950); font-size: .9rem; }
.match-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: .76rem; line-height: 1.35; }
.match-actions { display: flex; gap: 5px; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; color: var(--navy-800); background: white; border: 1px solid var(--line); border-radius: 9px; font-weight: 900; }
.icon-button.delete { color: #a43b35; }

.live-dot { padding: 6px 9px; color: #176c47; background: #e4f6ed; border-radius: 99px; font-size: .7rem; font-weight: 800; }
.live-dot::before { content: ""; width: 6px; height: 6px; margin-right: 5px; display: inline-block; background: #27a96e; border-radius: 50%; }
.canvas-frame { margin-top: 16px; padding: 8px; overflow: hidden; background: #dce4ed; border-radius: 15px; }
canvas { width: 100%; height: auto; display: block; background: var(--navy-900); border-radius: 9px; }
.separate-preview-grid { display: grid; gap: 24px; }
.poster-card { margin-top: 16px; padding: 14px; background: #f5f7fa; border: 1px solid var(--line); border-radius: 16px; }
.poster-card h3 { margin: 0; color: var(--navy-950); font-size: 1rem; }
.poster-card .canvas-frame { margin-top: 10px; }
.poster-card .export-actions { margin-top: 12px; }
.export-actions .button { flex: 1; }
.export-note { margin-top: 11px; color: var(--muted); font-size: .72rem; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; padding: 11px 16px; transform: translate(-50%, 20px); opacity: 0; color: white; background: #102540; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.2); pointer-events: none; transition: .22s ease; font-size: .82rem; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.app-footer { padding: 0 20px 28px; color: var(--muted); text-align: center; font-size: .76rem; letter-spacing: .03em; }
.app-footer strong { color: var(--navy-800); font-weight: 900; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; max-width: 760px; }
  .preview-panel { position: static; grid-row: 1; }
}

@media (max-width: 580px) {
  .topbar { padding-inline: 15px; }
  .save-state { display: none; }
  .access-gate { padding: 14px; }
  .access-card { border-radius: 20px; }
  .app-shell { padding: 14px 10px 36px; gap: 14px; }
  .editor-panel, .preview-panel { border-radius: 16px; }
  .editor-panel { padding: 18px 15px; }
  .preview-panel { padding: 15px; }
  .intro { align-items: center; }
  .weekend-fields, .form-grid { grid-template-columns: 1fr; }
  .poster-mode { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .location-switch label > span { padding-inline: 8px; }
  .match-item { grid-template-columns: auto 1fr; }
  .match-actions { grid-column: 2; }
  .export-actions { position: sticky; bottom: 8px; z-index: 2; padding: 8px; background: rgba(255,255,255,.92); border-radius: 13px; backdrop-filter: blur(10px); }
  .poster-card .export-actions { position: static; padding: 0; background: transparent; backdrop-filter: none; }
}
