:root {
  color-scheme: light;
  --bg: #eef3f8;
  --panel: #ffffff;
  --ink: #102238;
  --muted: #66758a;
  --line: #dce5ef;
  --navy: #0b2a52;
  --blue: #164d8d;
  --blue-soft: #e9f1fb;
  --green: #197443;
  --green-bg: #e9f8ef;
  --red: #a52929;
  --red-bg: #fff0f0;
  --yellow: #8a6500;
  --yellow-bg: #fff7d6;
  --gray-bg: #eef2f6;
  --shadow: 0 12px 34px rgba(19, 45, 79, .08);
}

* { box-sizing: border-box; }

html { min-width: 320px; font-size: var(--font-scale, 100%); }

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.4;
}

button, input, textarea, select { font: inherit; }

button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  background: var(--blue);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, opacity .15s ease;
}

button:hover:not(:disabled) { background: #0f3d73; }
button:active:not(:disabled) { transform: translateY(1px); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(22, 77, 141, .28);
  outline-offset: 2px;
}
button:disabled { cursor: wait; opacity: .65; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px clamp(18px, 5vw, 64px);
  background: linear-gradient(135deg, #071e3b, var(--navy) 58%, var(--blue));
  color: #fff;
}

.brand-lockup { display: flex; min-width: 0; flex: 1 1 auto; align-items: baseline; gap: 0 12px; }
.brand-lockup .eyebrow, .brand-lockup h1 { flex: 0 0 auto; }
.brand-lockup h1 { margin: 0; font-size: clamp(1.7rem, 4vw, 2.35rem); line-height: 1; letter-spacing: -.035em; }
.brand-lockup > p:last-child { min-width: 0; flex: 1 1 auto; overflow: hidden; margin: 0; color: rgba(255,255,255,.75); line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .12em;
  line-height: 1.2;
  text-transform: uppercase;
}
.topbar .eyebrow { color: rgba(255,255,255,.65); }

.top-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.last-updated { color: rgba(255,255,255,.78); font-size: .84rem; white-space: nowrap; }
.font-controls { display: flex; align-items: center; gap: 6px; }
.font-size-value { color: rgba(255,255,255,.78); font-size: .78rem; white-space: nowrap; }
.font-size-button { min-width: 34px; min-height: 32px; padding: 5px 8px; border: 1px solid rgba(255,255,255,.28); border-radius: 7px; background: rgba(255,255,255,.1); color: #fff; font-size: .86rem; line-height: 1; }
.font-size-button:hover:not(:disabled) { background: rgba(255,255,255,.2); }
.font-size-button:disabled { cursor: not-allowed; opacity: .45; }

@media (min-width: 761px) {
  .topbar { gap: 12px; padding-top: 4px; padding-bottom: 4px; }
  .top-actions { gap: 6px; }
  .top-actions > button { min-height: 34px; padding: 6px 10px; line-height: 1.1; }
}

.player-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 14px rgba(19, 45, 79, .06);
}
.player-tabs-inner {
  display: flex;
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 18px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.player-tab {
  min-height: 52px;
  flex: 0 0 auto;
  padding: 12px 17px;
  border-radius: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 850;
  white-space: nowrap;
}
.player-tab:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue); }
.player-tab.active { border-bottom-color: var(--blue); color: var(--navy); }

.view-tabs { background: var(--gray-bg); border-bottom: 1px solid var(--line); }
.view-tabs-inner { display: flex; max-width: 1220px; margin: 0 auto; padding: 0 18px; gap: 4px; }
.view-tab {
  min-height: 43px;
  padding: 9px 15px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: .8rem;
  font-weight: 850;
}
.view-tab:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue); }
.view-tab.active { border-bottom-color: var(--blue); color: var(--navy); }

main {
  max-width: 1220px;
  margin: 24px auto 58px;
  padding: 0 18px;
}

.panel, .entry-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.panel { padding: clamp(16px, 3vw, 24px); margin-bottom: 24px; }
.section-head, .section-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.section-heading-row { margin: 4px 0 13px; }
h2 { margin: 3px 0 0; font-size: 1.25rem; letter-spacing: -.02em; }
.section-head p:not(.eyebrow), .section-heading-row .muted { margin: 5px 0 0; color: var(--muted); }
.section-heading-row .muted { font-size: .86rem; text-align: right; }
.contest-line-note { align-self: center; color: var(--muted); font-size: .84rem; white-space: nowrap; }

code {
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--gray-bg);
  color: var(--ink);
  font-size: .92em;
}

.entry-editors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.entry-editor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--blue-soft));
}
.editor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editor-name-label, .editor-picks-label { color: var(--muted); font-size: .76rem; font-weight: 900; letter-spacing: .04em; text-transform: uppercase; }
.editor-picks-label { display: block; margin-top: 12px; }
.entry-name { margin-top: 5px; font-weight: 800; }
.editor-hint { margin: 6px 0 0; color: var(--muted); font-size: .76rem; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 11px;
  background: var(--panel);
  color: var(--ink);
}
textarea { min-height: 142px; resize: vertical; line-height: 1.55; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }

.danger {
  min-height: 34px;
  padding: 6px 9px;
  background: transparent;
  color: var(--red);
  border: 1px solid #e5bcbc;
  font-size: .78rem;
}
.danger:hover:not(:disabled) { background: var(--red-bg); color: var(--red); }

.setup-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.secondary {
  background: var(--gray-bg);
  color: var(--ink);
  border: 1px solid var(--line);
}
.secondary:hover:not(:disabled) { background: var(--blue-soft); color: var(--blue); }
.save-status { min-height: 1.2em; color: var(--muted); font-size: .82rem; }
.save-status.success { color: var(--green); }
.save-status.error { color: var(--red); }
.save-status.pending { color: var(--yellow); }

.advanced { margin-top: 17px; border-top: 1px solid var(--line); padding-top: 15px; }
.advanced summary { cursor: pointer; font-weight: 850; }
.advanced-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 12px; margin-top: 13px; }
label { font-size: .88rem; font-weight: 800; }
.label-hint { color: var(--muted); font-size: .75rem; font-weight: 500; }
label input, label select { display: block; margin-top: 5px; font-weight: 400; }
.advanced-footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 10px; }
.muted { color: var(--muted); font-size: .86rem; }
.advanced-footer .muted { margin: 0; }
.text-button { min-height: auto; padding: 4px 0; background: transparent; color: var(--blue); font-size: .84rem; }
.text-button:hover:not(:disabled) { background: transparent; color: var(--navy); text-decoration: underline; }

.status-banner {
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  font-size: .9rem;
}
.status-banner.info { background: var(--blue-soft); color: var(--blue); }
.status-banner.error { background: var(--red-bg); color: var(--red); border-color: #efc4c4; }
.hidden { display: none; }

.entry-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 24px; }
.entry-card { overflow: hidden; }
.entry-card-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; background: var(--navy); color: #fff; }
.entry-card-header .eyebrow { color: rgba(255,255,255,.62); }
.entry-card h3 { margin: 3px 0 0; font-size: 1.15rem; }
.pick-total { padding: 4px 8px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: rgba(255,255,255,.8); font-size: .76rem; font-weight: 800; white-space: nowrap; }
.entry-summary { display: flex; flex-wrap: wrap; gap: 7px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.count { padding: 5px 8px; border-radius: 999px; font-size: .74rem; font-weight: 900; }
.count.cover { background: var(--green-bg); color: var(--green); }
.count.lose { background: var(--red-bg); color: var(--red); }
.count.push { background: var(--yellow-bg); color: var(--yellow); }
.count.pending { background: var(--gray-bg); color: var(--muted); }

.pick-list { margin: 0; padding: 0; list-style: none; }
.pick-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.pick-row:last-child { border-bottom: 0; }
.pick-copy { min-width: 0; }
.pick-main { overflow-wrap: anywhere; font-size: .94rem; font-weight: 850; }
.pick-sub { margin-top: 3px; color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.pick-margin { margin-top: 4px; color: var(--muted); font-size: .78rem; }
.pick-margin strong { color: var(--ink); }
.empty-entry { margin: 0; padding: 18px 16px; color: var(--muted); font-size: .86rem; }

.badge { display: inline-flex; align-items: center; justify-content: center; padding: 5px 8px; border-radius: 999px; font-size: .7rem; font-weight: 950; letter-spacing: .02em; white-space: nowrap; }
.badge.cover { background: var(--green-bg); color: var(--green); }
.badge.lose { background: var(--red-bg); color: var(--red); }
.badge.push { background: var(--yellow-bg); color: var(--yellow); }
.badge.pending { background: var(--gray-bg); color: var(--muted); }

.picks-panel { padding-bottom: 12px; }
.picks-actions { display: flex; align-items: center; gap: 10px; }
.entry-record-panel {
  margin-top: 18px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, var(--blue-soft));
}
.entry-record-heading h3 { margin: 3px 0 0; font-size: 1.1rem; }
.entry-record-heading p:not(.eyebrow) { margin: 5px 0 0; color: var(--muted); font-size: .94rem; line-height: 1.45; }
.entry-records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 13px; }
.entry-record { display: flex; min-width: 0; min-height: 0; flex-direction: column; justify-content: center; gap: 8px; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); }
.entry-record-name { overflow-wrap: anywhere; font-size: 1rem; }
.entry-record-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; row-gap: 6px; color: var(--muted); font-size: .92rem; line-height: 1.45; }
.entry-record-breakdown > span { overflow-wrap: anywhere; }
.entry-record-breakdown strong { color: var(--ink); font-size: .94rem; }
.entry-record-detail { display: block; width: max-content; max-width: 100%; margin: 4px 0 0; padding: 3px 7px; border-radius: 5px; color: var(--muted); font-size: .86rem; font-weight: 750; letter-spacing: 0; line-height: 1.4; white-space: nowrap; }
.entry-record-solid-detail { display: block; width: max-content; max-width: 100%; margin: 4px 0 0; font-size: .86rem; font-weight: 850; letter-spacing: 0; line-height: 1.4; white-space: nowrap; }
.entry-record-status.won, .entry-record-status.won strong, .entry-record-status.won .entry-record-detail { color: var(--green); }
.entry-record-status.lost, .entry-record-status.lost strong, .entry-record-status.lost .entry-record-detail { color: var(--red); }
.entry-record-status.tied, .entry-record-status.tied strong, .entry-record-status.tied .entry-record-detail { color: var(--yellow); }
.entry-record-status.pending, .entry-record-status.pending strong, .entry-record-status.pending .entry-record-solid-detail { color: var(--ink); }
.entry-record-status.won .entry-record-detail { background: #dcfce7; color: #166534; box-shadow: 0 0 0 1px #bbf7d0; }
.entry-record-status.lost .entry-record-detail { background: #fee2e2; color: #991b1b; box-shadow: 0 0 0 1px #fecaca; }
.entry-record-status.tied .entry-record-detail { background: #fef3c7; color: #854d0e; box-shadow: 0 0 0 1px #fde68a; }
.entry-record-meta { color: var(--muted); font-size: .84rem; }
.empty-records { margin: 0; color: var(--muted); font-size: .82rem; }
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; min-width: 820px; border-collapse: collapse; }
th, td { padding: 12px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
th { background: var(--gray-bg); color: var(--muted); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: .84rem; }
td strong { font-size: .87rem; }
.empty-table { padding: 24px 14px; color: var(--muted); text-align: center; white-space: normal; }

footer { max-width: 1220px; margin: 0 auto; padding: 0 18px 40px; color: var(--muted); font-size: .78rem; }

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #08111c;
    --panel: #101b28;
    --ink: #edf4fb;
    --muted: #9fb0c2;
    --line: #26384b;
    --blue-soft: #142d4b;
    --gray-bg: #182635;
    --green-bg: #102d1e;
    --red-bg: #351717;
    --yellow-bg: #352d11;
    --green: #55d98a;
    --red: #ff7777;
    --yellow: #f2c75c;
    --shadow: none;
  }
  .secondary { color: var(--ink); }
  .entry-editor { background: color-mix(in srgb, var(--panel) 90%, var(--blue-soft)); }
  .player-tab.active { color: var(--ink); }
  .view-tab.active { color: var(--ink); }
  .status-banner.error { border-color: #6b3535; }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; flex-direction: column; gap: 6px; padding: 8px 12px; }
  .brand-lockup { width: 100%; gap: 0 8px; }
  .brand-lockup .eyebrow { font-size: .58rem; letter-spacing: .08em; }
  .brand-lockup h1 { font-size: clamp(1.35rem, 6vw, 1.8rem); }
  .brand-lockup > p:last-child { font-size: .7rem; line-height: 1; }
  .top-actions { width: 100%; justify-content: space-between; flex-wrap: nowrap; gap: 6px; }
  .last-updated { min-width: 0; flex: 1 1 auto; overflow: hidden; font-size: .68rem; text-overflow: ellipsis; }
  .font-controls { gap: 4px; }
  .font-size-value { font-size: .65rem; }
  .font-size-button { min-width: 30px; min-height: 30px; padding: 4px 6px; font-size: .8rem; }
  .top-actions > button { min-height: 32px; padding: 6px 8px; font-size: .78rem; line-height: 1; white-space: nowrap; }
  .section-head, .section-heading-row { flex-direction: column; gap: 10px; }
  .section-heading-row .muted { text-align: left; }
  .contest-line-note { align-self: flex-start; }
  .picks-actions { align-self: flex-start; }
  .advanced-grid { grid-template-columns: 1fr; }
  .advanced-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
  .setup-actions { justify-content: stretch; flex-wrap: wrap; }
  .setup-actions .save-status { order: 3; width: 100%; }
  .setup-actions button { flex: 1; }
  .entry-cards { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  main { margin-top: 16px; padding: 0 12px; }
  .player-tabs-inner { padding: 0 12px; }
  .player-tab { padding-left: 13px; padding-right: 13px; }
  .view-tabs-inner { padding: 0 12px; }
  .panel { padding: 15px; border-radius: 13px; }
  .entry-card-header, .entry-summary, .pick-row { padding-left: 13px; padding-right: 13px; }
  .topbar { gap: 4px; padding: 6px 12px; }
  .brand-lockup { gap: 0 6px; }
  .brand-lockup .eyebrow { font-size: .55rem; letter-spacing: .06em; }
  .brand-lockup h1 { font-size: 1.55rem; }
  .brand-lockup > p:last-child { font-size: .64rem; }
  .font-size-value { display: none; }
  .last-updated { font-size: .62rem; }
  .pick-row { gap: 8px; }
  .badge { font-size: .64rem; }
  footer { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 560px) {
  .entry-records { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .entry-record-breakdown { grid-template-columns: 1fr; }
}
