:root {
  --bg: #0b1020;
  --card: #141b34;
  --text: #f2f5ff;
  --muted: #9aa3b2;
  --accent: #2dd4bf;
}
*{ box-sizing: border-box; }
html, body { margin:0; padding:0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; height: 100%; }
#app {
  display: flex;
  flex-direction: column;
  height: 100%;
}
#app.app-has-bg {
  background-image: url('/assets/ctp_cover_image.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
#app.no-header .app-header {
  display: none;
}
.app-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; background-color: rgba(13, 19, 40, 0.5); border-bottom: 1px solid rgba(45, 53, 90, .5); position: sticky; top:0; z-index:10; }
.brand {
  font-weight: 700;
  letter-spacing: .5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.brand-logo {
  width: 30px;
  height: 30px;
  margin-right: 8px;
}

.auth-controls { display:flex; gap:8px; align-items:center; }
.user-chip { font-size:.9rem; color: var(--muted); }
.profile { max-width: 520px; margin: 20px auto; background: var(--card); padding: 16px; border-radius: 12px; border:1px solid #1c2548; }
.profile .form { display:flex; flex-direction:column; gap:10px; }
.profile label { font-weight:600; }
.profile input { padding:10px 12px; border-radius:8px; border:1px solid #24305c; background:#0e1530; color:var(--text); }
.profile .actions { display:flex; gap:8px; }
.profile .hint { color: var(--muted); font-size:.85rem; }
.view {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.view.signin-page {
  padding: 0;
  justify-content: flex-end;
  align-items: center;
}


.view.games-list-page h2 {
  color: #fff;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.view.games-list-page .game-card {
  background-color: rgba(13, 19, 40, 0.85);
  border: 1px solid rgba(45, 53, 90, 0.7);
}

.game-header {
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

.play-card, .panel, .game-header {
  background-color: rgba(13, 19, 40, 0.85) !important;
  border: 1px solid rgba(45, 53, 90, 0.7) !important;
  color: #fff !important;
}

.signin-content-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-bottom: 40px;
}

.signin-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 40px;
}

.signin-logo {
  width: 180px;
  height: 180px;
  margin-bottom: 20px;
}

.signin-brand > span {
  font-size: 28pt;
  color: #fff;
  font-weight: bold;
}

.signin-subtitle {
  font-size: 18pt;
  color: #fff;
  margin-top: 6px;
}

.signin-links {
  margin-top: 24px;
  text-align: center;
}

.signin-links a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.signin-links a:hover {
  text-decoration: underline;
}

.signin-view {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.btn { background:#1d264b; color:var(--text); border:none; padding:10px 14px; border-radius:8px; cursor:pointer; }
.btn.primary { background:#4f46e5; color:#fff; }
.center { display:flex; flex-direction:column; align-items:center; gap:12px; margin-top:20vh; }

.overlay { position:fixed; inset:0; background: rgba(0,0,0,.6); display:flex; align-items:center; justify-content:center; }
.overlay-card { background: var(--card); padding:16px; border-radius:12px; width:min(420px, 92vw); box-shadow: 0 10px 30px rgba(0,0,0,.4); display:flex; gap:10px; flex-direction:column; }
.overlay-card input { padding:10px 12px; border-radius:8px; border:1px solid #24305c; background:#0e1530; color:var(--text); }

.game-list { list-style:none; padding:0; margin:0; display:grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap:12px; }
.game-item { cursor:pointer; }
.game-card { background: var(--card); padding:12px; border-radius:16px; border:1px solid #1c2548; box-shadow: 0 6px 16px rgba(0,0,0,0.25); }
.game-card:hover { transform: translateY(-1px); transition: transform .15s ease; }
.gc-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
.gc-time { color: var(--muted); font-size:.9rem; text-transform: lowercase; }
.gc-body { display:grid; grid-template-columns: 1fr 60px 1fr; align-items:center; gap:10px; padding: 8px 0; }
.gc-vs { text-align:center; color: var(--muted); font-weight:700; }
.team { display:flex; flex-direction:column; align-items:center; gap:8px; }
.team-logo { width: 96px; height: 96px; border-radius: 999px; border: 2px solid #3b3f66; display:flex; align-items:center; justify-content:center; background:#0f1730; }
.team-logo img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5)); }
.team-name { font-size: 1.05rem; font-weight: 700; text-align: center; }
.gc-footer { margin-top: 8px; color: var(--muted); text-align:center; }
.gc-payout { margin-top: 6px; text-align: center; }
.money-anim {
  font-weight: 800;
  background: linear-gradient(90deg, #16a34a, #22c55e, #a3e635, #22c55e, #16a34a);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: money-shine 3s linear infinite;
  text-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
@keyframes money-shine {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}
.badge { display:inline-block; padding:2px 8px; border-radius:999px; font-size:.75rem; border:1px solid #1c2548; background:#2d2d2d; color:#d2d2d2; }
.badge.live { background:#17351f; color:#8cffb0; border-color:#175c2b; }
.empty { color: var(--muted); }

.game-header { background: var(--card); padding:12px; border-radius:12px; border:1px solid #1c2548; margin-bottom:12px; }
.game-header.compact { display:flex; align-items:center; justify-content:space-between; gap:8px; }
/* Revert header custom layout to original compact bar (no logo grid) */
.btn-icon { padding:6px 10px; }
.gh-center { flex:1; display:flex; align-items:center; justify-content:center; gap:8px; min-height: 22px; }
.gh-summary { font-size:.95rem; font-weight:600; }
.gh-spacer { width:32px; height:1px; }
.plays {
  display:flex;
  flex-direction:column;
  gap:10px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}
.game-body { display:grid; grid-template-columns: 1fr; gap:12px; }
.messages { display:flex; flex-direction:column; gap:6px; max-height: 260px; overflow:auto; }
.composer { display:flex; gap:6px; margin-top:8px; }
.composer input { flex:1; padding:8px 10px; border-radius:8px; border:1px solid #24305c; background:#0e1530; color:var(--text); }
.panel { background: #0f1730; border:1px solid #1b2348; border-radius:8px; padding:8px; margin-top:8px; }
.king-chat .kc-list { padding-top: 4px; }
.kc-row { padding: 2px 0; }
.lb-list { list-style: none; padding-left: 0; margin: 0; }
.prev-plays { margin-top: 8px; }
.prev-plays .prev-list { max-height: 320px; overflow: auto; padding-right: 6px; }
.points-summary { background: var(--accent); color: #0b1020; font-weight: 600; }
.chip { transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
.final-overlay { z-index: 1000; }
.final-card { text-align: center; }
.final-stats { margin: 16px 0; }
.final-stats .rank { font-size: 1.2rem; margin-bottom: 8px; }
.final-stats .points { color: var(--accent); font-size: 1.1rem; }
.final-stats .winner { color: #ffd700; font-size: 1.3rem; margin-top: 12px; }
.stats-section { margin-top: 24px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 12px; }
.stat-item { background: var(--card); padding: 12px; border-radius: 8px; text-align: center; }
.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }

.football-field-selector {
    display: flex;
    width: 100%;
    height: 60px;
    background: #0a1e0f;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #1c2548;
}

.field-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.field-segment:last-child {
    border-right: none;
}

.field-segment.selected {
    background: var(--accent);
    color: #0b1020;
}

/* Correctness states for field segments */
.field-segment.correct { border: 2px solid #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.3) inset; }
.field-segment.incorrect { border: 2px solid #f87171; box-shadow: 0 0 8px rgba(248, 113, 113, 0.3) inset; }

.field-segment .segment-label {
    font-weight: bold;
    font-size: 14px;
}

.line-of-scrimmage {
    width: 2px;
    background: #3b82f6;
}

.goal-line {
    width: 2px;
    background: #ffffff;
}

.field-segment.locked {
    cursor: default;
    pointer-events: none;
}

.field-segment .points-badge {
    top: 2px;
    right: 2px;
    font-size: 10px;
    padding: 1px 3px;
}

/* Option cards with background images */
.option-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.option-card, .roster-card { 
  width: 80px; height: 80px; border-radius: 10px; 
  background: var(--card); border: 2px solid #1c2548; 
  cursor: pointer; position: relative; display: flex; align-items: flex-end; justify-content: center;
  overflow: hidden; /* Keep pseudo-elements contained */
}

.option-card::before, .roster-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
  z-index: 1;
}

.option-card.selected { border-color: var(--accent); }
.option-card.locked { opacity: 1; cursor: default; pointer-events: none; }
.roster-card.locked { opacity: 1; cursor: default; pointer-events: none; }
.option-card.correct, .roster-card.correct { 
  border-color: #22c55e; 
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6) inset, 0 0 8px rgba(34, 197, 94, 0.35);
}
.option-card.incorrect, .roster-card.incorrect { 
  border-color: #f87171; 
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.6) inset, 0 0 8px rgba(248, 113, 113, 0.35);
}
/* Ensure correctness overrides selected accent when both classes are present */
.option-card.selected.correct, .roster-card.selected.correct {
  border-color: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6) inset, 0 0 8px rgba(34, 197, 94, 0.35);
}
.option-card.selected.incorrect, .roster-card.selected.incorrect {
  border-color: #f87171;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.6) inset, 0 0 8px rgba(248, 113, 113, 0.35);
}

.points-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 3;
}

.position-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.7);
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
  z-index: 3;
}

.option-label, .roster-label { 
  background: none; /* Remove solid background, let gradient show */
  position: relative;
  z-index: 2; /* Ensure text is above the gradient overlay */
  color: white; font-weight: bold; font-size: 14px; 
  text-transform: uppercase; text-align: center; padding: 4px; width: 100%;
}

.roster-row { display: flex; flex-wrap: wrap; gap: 4px; }

.roster-card.selected { border-color: var(--accent); }

.ok { color: #8cffb0; }
.bad { color: #ff9a9a; }
.play-card { 
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.play-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-weight: bold;
}

.q-box {
  padding: 0 12px 12px;
}

/* Enter animation */
.play-card.enter {
  transform: translateY(12px);
  opacity: 0;
}
.play-card.enter.enter-active {
  transform: translateY(0);
  opacity: 1;
}

/* Exit animation */
.play-card.exit {
  will-change: transform, opacity;
}
.play-card.exit.exit-active {
  transform: translateY(-20px);
  opacity: 0;
}

.points-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32pt;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  opacity: 1;
  transition: opacity 0.4s ease-in-out;
  pointer-events: none;
  z-index: 10;
}

.points-popup.exit {
  opacity: 0;
}

.seq { font-weight: bold; }
.status-label { font-style: italic; color: var(--muted); }
.type-label { display:none; }
.play-card .seq { color: var(--muted); }
.play-card .badge { display:inline-block; padding:4px 10px; border-radius:999px; font-size:.85rem; border:1px solid #1c2548; }
.play-card .pc-badge { font-weight: 700; letter-spacing: .25px; }
.badge.locked { background:#352117; color:#ffc6a8; border-color:#5c3717; }
.q-box { width: 100%; margin-top: 6px; }
.pc-head { display:flex; align-items:center; justify-content:space-between; }
.pc-title { font-weight:600; }
.pc-toggle { background:#1d264b; color:var(--text); border:none; padding:6px 10px; border-radius:8px; cursor:pointer; }
.pc-min { color: var(--muted); }
.q-title { font-weight: 600; margin-bottom: 8px; }
.muted.tiny { font-size: 12px; opacity: 0.65; margin-top: 4px; }
.panel .row { display: flex; align-items: center; justify-content: space-between; }
.prev-play-row { padding: 6px 0; border-top: 1px solid #1b2348; }
.q-step { 
  margin-bottom: 12px; 
}
.q-step .q-prompt { font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.gh-status, .gh-king, .gh-possession, .gh-down, .gh-distance, .gh-los, .gh-clock { font-size:.9rem; }
.pc-resolved { font-weight:600; margin-top:6px; }
.summary-item {
    padding: 8px;
    border-radius: 8px;
    background: #0f1730;
    border: 1px solid #1b2348;
}
.summary-item .q-prompt {
    font-size: .8rem;
    color: var(--muted);
}
.summary-item .q-answer {
    font-weight: 600;
}
.toaster { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #0f1730; border:1px solid #1b2348; color: var(--text); padding:10px 12px; border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,.35); }

.floating-lb {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 260px;
  max-height: 40vh;
  overflow: auto;
  z-index: 100;
  padding: 10px 12px;
}

.lb-toggle {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.lb-chevron {
  transition: transform 0.2s ease-in-out;
}

.lb-chevron.expanded {
  transform: rotate(180deg);
}

.floating-lb-title {
  margin: 0 0 4px 0;
}

.your-score {
  font-size: 0.9rem;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

/* Floating Chat (bottom-right) */
.floating-chat {
  position: fixed;
  right: 20px;
  bottom: calc(20px + var(--kb-safe-bottom, 0px));
  z-index: 100;
}

.chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid #1c2548;
  cursor: pointer;
  position: relative;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.chat-fab .icon {
  font-size: 22px;
}

.chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e11d48;
  color: white;
  font-weight: 700;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 2px solid var(--bg);
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: calc(84px + var(--kb-safe-bottom, 0px));
  width: min(360px, 92vw);
  max-height: 45vh;
  overflow: hidden;
  background: var(--card);
  border: 1px solid #1c2548;
  border-radius: 12px;
  display: none;
  flex-direction: column;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
}

.chat-panel.open { display: flex; }

.chat-panel .chat-header {
  padding: 8px 10px;
  border-bottom: 1px solid #1c2548;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-panel .chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  padding: 10px;
}

.chat-panel .chat-composer {
  display: flex;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid #1c2548;
  background: #0f1730;
}

.chat-panel .chat-composer input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #24305c;
  background: #0e1530;
  color: var(--text);
  font-size: 16px;
}

/* App Message Overlay */
.app-message-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.app-message-lines {
  position: absolute;
  left: 50%;
  bottom: calc(40px + var(--lb-height, 0px) + var(--kb-safe-bottom, 0px));
  transform: translate(-50%, 0);
  text-align: center;
  font-size: 28pt;
  font-weight: 700;
  line-height: 1.1;
  color: var(--text);
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  width: 100vw;
  padding: 0 10px;
  box-sizing: border-box;
  white-space: normal;
  word-break: normal;
  overflow-wrap: anywhere;
}

.app-message-title { text-align: center; margin-bottom: 20px; width: 100%; opacity: 0; animation: amTitleIn .25s ease-out forwards; }
.app-message-body { font-size: 24pt; text-align: left; margin: 0 auto; width: 100%; white-space: normal; word-break: normal; overflow-wrap: anywhere; display: block; opacity: 0; animation: amBodyIn .25s ease-out forwards; animation-delay: 1.5s; }
.app-message-text { font-weight: 600; white-space: normal; word-break: normal; overflow-wrap: anywhere; display: block; }

@keyframes amTitleIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes amBodyIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px){
  .play-card { grid-template-columns: 1fr; }
  .game-body { grid-template-columns: 1fr; }
  .option-chips { grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); }
  .roster-row { grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); }
}

@media (max-width: 600px){
  .play-card { grid-template-columns: 1fr; }
}


