/* Paper book — book-themed golf props paper trading */

*, *::before, *::after { box-sizing: border-box; }

:root {
  --font: "Inter", system-ui, sans-serif;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --bg: #121212;
  --surface: #1e1e1e;
  --surface2: #2a2a2a;
  --text: #f5f5f5;
  --muted: #9ca3af;
  --accent: #53d337;
  --accent-text: #000;
  --accent-dim: rgba(83, 211, 55, 0.15);
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(255, 255, 255, 0.08);
  --header-bg: #000;
  --btn-over: #53d337;
  --btn-under: #374151;
  --place-btn: linear-gradient(180deg, #53d337, #3db828);
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.paper-app {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.book-draftkings {
  --accent: #53d337;
  --accent-dim: rgba(83, 211, 55, 0.12);
  --header-bg: #000;
  --place-btn: linear-gradient(180deg, #53d337, #3db828);
  --btn-over: #53d337;
}

body.book-prizepicks {
  --accent: #7c3aed;
  --accent-dim: rgba(124, 58, 237, 0.2);
  --bg: #0f0a1a;
  --surface: #1a1230;
  --surface2: #251a45;
  --header-bg: linear-gradient(135deg, #4c1d95, #7c3aed);
  --place-btn: linear-gradient(135deg, #a855f7, #7c3aed);
  --btn-over: #a855f7;
  --btn-under: #312e81;
}

body.book-sleeper {
  --accent: #00ceb8;
  --accent-dim: rgba(0, 206, 184, 0.15);
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --header-bg: #0d1117;
  --place-btn: linear-gradient(180deg, #00ceb8, #00a896);
  --btn-over: #00ceb8;
  --btn-under: #30363d;
}

body.book-underdog {
  --accent: #f5c518;
  --accent-dim: rgba(245, 197, 24, 0.15);
  --accent-text: #111;
  --bg: #111;
  --surface: #1a1a1a;
  --surface2: #262626;
  --header-bg: #000;
  --place-btn: linear-gradient(180deg, #f5c518, #d4a017);
  --btn-over: #f5c518;
  --btn-under: #333;
  --text: #fafafa;
}

body.book-kalshi {
  --accent: #09c285;
  --accent-dim: rgba(9, 194, 133, 0.15);
  --header-bg: #0b1f17;
  --place-btn: linear-gradient(180deg, #09c285, #078a60);
  --btn-over: #09c285;
  --btn-under: #1f2937;
}

body.book-dk_matchups {
  --accent: #53d337;
  --accent-dim: rgba(83, 211, 55, 0.12);
  --header-bg: #000;
  --place-btn: linear-gradient(180deg, #53d337, #3db828);
  --btn-over: #53d337;
  --btn-under: #374151;
}

.book-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.book-header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 1.25rem;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.back-link:hover { color: var(--text); background: var(--surface2); }

.book-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.book-logo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--accent);
  flex-shrink: 0;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

body.book-draftkings .book-logo {
  background-image: url("https://www.google.com/s2/favicons?domain=draftkings.com&sz=64");
  background-color: #000;
}
body.book-prizepicks .book-logo {
  background-image: url("https://www.google.com/s2/favicons?domain=prizepicks.com&sz=64");
  background-color: #7c3aed;
}
body.book-sleeper .book-logo {
  background-image: url("https://www.google.com/s2/favicons?domain=sleeper.com&sz=64");
  background-color: #0d1117;
}
body.book-underdog .book-logo {
  background-image: url("https://www.google.com/s2/favicons?domain=underdogfantasy.com&sz=64");
  background-color: #000;
}

.book-title { margin: 0; font-size: 1.1rem; font-weight: 700; line-height: 1.2; }
.book-sub {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-right { display: flex; align-items: center; gap: 8px; }

.balance-pill {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}

.icon-btn, .text-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: inherit;
}
.icon-btn:hover, .text-btn:hover { background: var(--surface2); }

.book-switcher {
  display: flex;
  gap: 4px;
  padding: 0 12px 10px;
  overflow-x: auto;
}

.book-tab {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}
.book-tab:hover { color: var(--text); background: var(--surface2); }
.book-tab.active {
  background: var(--accent);
  color: var(--accent-text, #000);
}
body.book-prizepicks .book-tab.active { color: #fff; }

.event-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  font-size: 0.82rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.event-updated { color: var(--muted); font-size: 0.75rem; }

.banner { margin: 0; padding: 10px 16px; font-size: 0.82rem; }
.banner-warn {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-bottom: 1px solid rgba(245, 158, 11, 0.3);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  align-items: end;
}

.toolbar-search { flex: 1; min-width: 160px; }
.toolbar-search input,
.toolbar-select select {
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.toolbar-select { font-size: 0.78rem; color: var(--muted); }

.main-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  flex: 1;
  align-items: start;
}

@media (min-width: 900px) {
  .main-layout {
    grid-template-columns: 1fr 340px;
    gap: 16px;
    padding: 0 16px 24px;
  }
}

.props-board {
  padding: 0 16px 100px;
  display: grid;
  gap: 10px;
}

@media (min-width: 600px) {
  .props-board { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
}

.prop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

body.book-draftkings .prop-card { border-left: 3px solid var(--accent); }

.prop-card.in-slip {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}

.prop-player { font-weight: 700; font-size: 0.95rem; line-height: 1.3; }

.prop-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.prop-market {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.prop-line { font-size: 1.5rem; font-weight: 800; line-height: 1; }
body.book-prizepicks .prop-line { font-family: "Archivo Black", sans-serif; }

.prop-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.matchup-sides {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: stretch;
}

.matchup-vs {
  align-self: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}

.matchup-card .side-btn.matchup-side {
  min-height: 64px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
}

.matchup-card .side-label {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
}

.side-btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  justify-content: center;
}
.side-btn:active { transform: scale(0.97); }
.side-btn.over { background: var(--btn-over); color: var(--accent-text, #000); }
body.book-prizepicks .side-btn.over { color: #fff; }
body.book-sleeper .side-btn.over { color: #000; }
.side-btn.under { background: var(--btn-under); color: var(--text); }
.side-btn.selected { outline: 3px solid #fff; outline-offset: 2px; }
body.book-underdog .side-btn.over.selected { outline-color: #000; }

.side-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.85;
}
.side-odds { font-size: 0.95rem; font-weight: 700; }

.slip-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 55dvh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  z-index: 40;
}

@media (min-width: 900px) {
  .slip-panel {
    position: sticky;
    top: 120px;
    bottom: auto;
    max-height: calc(100dvh - 140px);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .props-board { padding-bottom: 24px; }
}

.slip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--border);
}
.slip-title { margin: 0; font-size: 1rem; font-weight: 700; }

.pp-play-toggle { display: flex; gap: 6px; padding: 8px 16px; }

.play-type {
  flex: 1;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.play-type.active {
  background: var(--accent);
  color: var(--accent-text, #fff);
  border-color: transparent;
}
body.book-prizepicks .play-type.active { color: #fff; }

.slip-legs { overflow-y: auto; padding: 8px 16px; flex: 1; min-height: 0; }

.slip-leg {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.slip-leg:last-child { border-bottom: none; }
.slip-leg-main { flex: 1; min-width: 0; }
.slip-leg-player { font-weight: 600; }
.slip-leg-pick { color: var(--accent); font-weight: 600; font-size: 0.82rem; }
.slip-leg-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 4px;
}
.slip-leg-remove:hover { color: var(--danger); }

.slip-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}
.slip-legs:not(:empty) + .slip-empty { display: none; }

.slip-footer {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.payout-preview {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
  min-height: 1.2em;
}

.stake-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.stake-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.stake-prefix { padding: 8px 0 8px 10px; color: var(--muted); }

#stake-input {
  width: 80px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  padding: 8px;
  font-family: inherit;
}

.quick-stakes { display: flex; gap: 6px; margin-bottom: 10px; }

.quick-stake {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 6px;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: inherit;
}
.quick-stake:hover { border-color: var(--accent); color: var(--accent); }

.place-btn {
  width: 100%;
  border: none;
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  background: var(--place-btn);
  color: var(--accent-text, #000);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
body.book-prizepicks .place-btn { color: #fff; }
body.book-sleeper .place-btn { color: #000; }
.place-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.place-btn:not(:disabled):hover { filter: brightness(1.08); }

.history-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0;
  max-width: 560px;
  width: calc(100% - 32px);
  max-height: 85dvh;
}
.history-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }

.history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.history-head h2 { margin: 0; font-size: 1.1rem; }

.history-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.stat-box {
  text-align: center;
  padding: 8px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
}
.stat-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; }
.stat-value { font-size: 1rem; font-weight: 700; margin-top: 4px; }
.stat-value.pos { color: var(--success); }
.stat-value.neg { color: var(--danger); }

.history-list { overflow-y: auto; max-height: 45dvh; padding: 8px 16px; }

.history-entry {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.history-entry:last-child { border-bottom: none; }

.entry-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}

.entry-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  font-weight: 600;
}

.entry-book { color: var(--text); }
.entry-stake { color: var(--accent); }
.entry-round {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.entry-status {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
}
.entry-status.open { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.entry-status.win { background: rgba(34, 197, 94, 0.2); color: #4ade80; }
.entry-status.loss { background: rgba(239, 68, 68, 0.2); color: #f87171; }
.entry-status.push { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }

.entry-legs { color: var(--text); font-size: 0.8rem; line-height: 1.5; margin-bottom: 4px; }

.entry-meta {
  color: var(--muted);
  font-size: 0.72rem;
}

.history-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
}

.history-sync-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
}

.history-sync-note code {
  font-size: 0.72rem;
}

.history-sync-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-actions input {
  margin-left: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  width: 100px;
  font-family: inherit;
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  border: 1px solid var(--accent);
  z-index: 100;
}

.empty-board {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
