/* ── Screens ─────────────────────────────────────────────────────────────── */
.screen { display: none; height: 100vh; }
.screen.active { display: flex; }

/* ── Landing ─────────────────────────────────────────────────────────────── */
#screen-landing {
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(52,72,255,0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 75%, rgba(161,137,227,0.14) 0%, transparent 50%),
    radial-gradient(ellipse at 65% 5%,  rgba(168,235,255,0.2)  0%, transparent 40%),
    radial-gradient(ellipse at 10% 85%, rgba(66,148,99,0.1)   0%, transparent 40%),
    var(--bg);
  overflow-y: auto;
  padding: 20px 0;
}

.landing-box {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.68);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.85);
  border-radius: 24px;
  padding: 36px;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: auto;
  animation: fadeSlideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -1px 0 rgba(8,17,46,0.04),
    0 24px 64px rgba(8,17,46,0.12),
    0 0 0 0.5px rgba(8,17,46,0.06);
}

.logo        { text-align: center; }
.logo-icon   { font-size: 48px; line-height: 1; }
.logo h1     { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: -0.03em; }
.logo p      { color: var(--muted); margin-top: 4px; font-size: 14px; letter-spacing: -0.01em; }

.input-group       { display: flex; flex-direction: column; gap: 5px; }
.input-group label { font-size: 13px; color: var(--muted); font-weight: 500; }
.custom-deck-wrap { display: flex; flex-direction: column; gap: 4px; }
.custom-deck-wrap.hidden { display: none; }
.custom-deck-hint { font-size: 11px; color: var(--muted); }
.label-optional    { font-weight: 400; color: var(--muted); }

input[type=text],
.select-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(8,17,46,0.12);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}
input[type=text]:focus, .select-input:focus {
  border-color: rgba(52,72,255,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 0 0 3px rgba(52,72,255,0.15);
}

.select-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236272a0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
.select-input option { background: var(--surface); }

.divider { height: 1px; background: rgba(8,17,46,0.08); margin: 2px 0; }

.toggle-row  { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-info { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.toggle-label { font-size: 14px; color: var(--text); font-weight: 500; }
.toggle-hint  { font-size: 12px; color: var(--muted); }

.toggle-btn {
  flex-shrink: 0;
  width: 44px; height: 24px;
  border-radius: 12px;
  background: rgba(8,17,46,0.18);
  border: none; cursor: pointer;
  position: relative;
  transition: background 0.2s;
}
.toggle-btn::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s;
}
.toggle-btn.active { background: var(--primary); }
.toggle-btn.active::after { transform: translateX(20px); }

.tabs {
  display: flex; gap: 2px;
  background: rgba(8,17,46,0.07);
  border-radius: 12px; padding: 3px;
  border: 1px solid rgba(8,17,46,0.06);
}
.tab-btn {
  flex: 1; padding: 8px; border: none;
  background: transparent; color: var(--muted);
  border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 500; transition: all 0.2s;
  font-family: inherit;
}
.tab-btn.active {
  background: rgba(255,255,255,0.88);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255,255,255,1), 0 1px 6px rgba(8,17,46,0.1);
  border: 1px solid rgba(8,17,46,0.06);
}

.tab-panel        { display: none; flex-direction: column; gap: 14px; }
.tab-panel.active { display: flex; }

.btn-primary {
  width: 100%; padding: 12px;
  background: #3448ff;
  color: white;
  border: 1px solid rgba(52,72,255,0.5);
  border-radius: 12px;
  font-size: 15px; font-weight: 700;
  cursor: pointer; transition: opacity 0.2s; margin-top: 4px;
  box-shadow: 0 4px 20px rgba(52,72,255,0.3);
  font-family: inherit;
}
.btn-primary:hover { opacity: 0.88; }

.error-msg { color: var(--error); font-size: 13px; text-align: center; min-height: 18px; }

/* ── Segmented Control ───────────────────────────────────────────────────── */
.seg-control {
  display: flex; gap: 2px;
  background: rgba(8,17,46,0.07);
  border-radius: 12px; padding: 3px;
  border: 1px solid rgba(8,17,46,0.06);
}
.seg-btn {
  flex: 1; padding: 8px 12px; border: none;
  background: transparent; color: var(--muted);
  border-radius: 9px; cursor: pointer;
  font-size: 14px; font-weight: 500;
  transition: all 0.18s; font-family: inherit; line-height: 1;
}
.seg-btn.active {
  background: rgba(255,255,255,0.9);
  color: var(--primary); font-weight: 600;
  box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(8,17,46,0.1);
  border: 1px solid rgba(8,17,46,0.06);
}

/* ── Custom Select ───────────────────────────────────────────────────────── */
.custom-select { position: relative; }
.csel-trigger {
  width: 100%; padding: 10px 12px 10px 14px;
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(8,17,46,0.12);
  border-radius: 10px; color: var(--text);
  font-size: 14px; font-family: inherit;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.csel-trigger:hover { border-color: rgba(52,72,255,0.25); }
.csel-trigger.open {
  border-color: rgba(52,72,255,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), 0 0 0 3px rgba(52,72,255,0.15);
}
.csel-value { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-chevron { flex-shrink: 0; color: var(--muted); display: flex; transition: transform 0.2s cubic-bezier(0.4,0,0.2,1); }
.csel-trigger.open .csel-chevron { transform: rotate(180deg); }

.csel-dropdown {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 300;
  background: rgba(248,250,255,0.97);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(52,72,255,0.15);
  border-radius: 14px; padding: 6px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    0 8px 32px rgba(52,72,255,0.12),
    0 2px 8px rgba(8,17,46,0.08);
  list-style: none;
  animation: dropIn 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  max-height: 280px; overflow-y: auto;
}
.csel-dropdown.hidden { display: none !important; }
@keyframes dropIn {
  from { opacity: 0; transform: scale(0.96) translateY(-6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.csel-option {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background 0.12s;
}
.csel-option:hover { background: rgba(52,72,255,0.07); }
.csel-option.selected { background: rgba(52,72,255,0.06); }
.csel-opt-content { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.csel-opt-label { font-size: 14px; color: var(--text); font-weight: 500; }
.csel-option.selected .csel-opt-label { color: var(--primary); font-weight: 600; }
.csel-opt-sub { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csel-check { flex-shrink: 0; color: var(--primary); opacity: 0; display: flex; transition: opacity 0.15s; }
.csel-option.selected .csel-check { opacity: 1; }

/* ── Game Layout ─────────────────────────────────────────────────────────── */
#screen-game {
  flex-direction: column; position: relative;
  /* Scoped blue-forward palette for the playing area */
  --muted: #3f52c8;
  --glass: rgba(225,232,255,0.68);
  --glass-border: rgba(52,72,255,0.16);
  --glass-hi: rgba(255,255,255,0.85);
  background:
    radial-gradient(ellipse at 10% 15%, rgba(52,72,255,0.18)  0%, transparent 45%),
    radial-gradient(ellipse at 90% 80%, rgba(161,137,227,0.16) 0%, transparent 45%),
    radial-gradient(ellipse at 75% 5%,  rgba(168,235,255,0.22) 0%, transparent 35%),
    radial-gradient(ellipse at 5%  90%, rgba(66,148,99,0.1)   0%, transparent 40%),
    var(--bg);
}

.game-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--glass, rgba(255,255,255,0.65));
  backdrop-filter: blur(32px) saturate(180%);
  -webkit-backdrop-filter: blur(32px) saturate(180%);
  border-bottom: 1px solid var(--glass-border, rgba(8,17,46,0.08));
  box-shadow: 0 1px 0 var(--glass-hi, rgba(255,255,255,0.8)), 0 4px 24px rgba(52,72,255,0.08);
  flex-shrink: 0; gap: 12px;
}

.header-left        { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-game-info   { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.header-center      { flex: 1; display: flex; align-items: center; justify-content: center; gap: 16px; }
.header-right       { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.header-sep         { width: 1px; height: 20px; background: var(--glass-border, rgba(8,17,46,0.1)); flex-shrink: 0; }

.game-name-display {
  font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.game-name-display:empty { display: none; }

.room-label        { font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: 0; }
.room-label strong { color: var(--primary); letter-spacing: 2px; font-weight: 700; font-size: 12px; }

.btn-ghost {
  padding: 6px 12px;
  background: var(--glass, rgba(255,255,255,0.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(8,17,46,0.12));
  box-shadow: inset 0 1px 0 var(--glass-hi, rgba(255,255,255,0.8));
  color: var(--text);
  border-radius: 10px; cursor: pointer; font-size: 13px;
  white-space: nowrap; transition: background 0.15s, border-color 0.15s, color 0.15s;
  font-family: inherit; font-weight: 500;
}
.btn-ghost:hover { background: rgba(255,255,255,0.88); color: var(--primary); border-color: rgba(52,72,255,0.22); }
.btn-ghost-icon { padding: 6px 8px; color: var(--muted); }
.btn-ghost-icon:hover { color: var(--primary); }
.btn-ghost.copied      { color: var(--success); border-color: var(--success); }
.btn-ghost.jira-linked { color: var(--primary); border-color: var(--primary); }

.btn-reveal {
  padding: 8px 20px;
  background: rgba(52,72,255,0.08);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  color: var(--primary); font-family: inherit;
  border: 1px solid rgba(52,72,255,0.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
  border-radius: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background 0.2s; white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn-reveal:hover { background: rgba(52,72,255,0.14); }

.btn-leave {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 11px;
  background: transparent;
  border: 1px solid rgba(220,38,38,0.25);
  border-radius: 10px; cursor: pointer;
  font-size: 12px; font-weight: 500; color: rgba(220,38,38,0.7);
  font-family: inherit; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-leave:hover { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.5); color: rgb(220,38,38); }

.btn-new-round {
  padding: 8px 20px;
  background: #3448ff;
  color: white; font-family: inherit;
  border: 1px solid rgba(52,72,255,0.5);
  box-shadow: 0 4px 16px rgba(52,72,255,0.25);
  border-radius: 12px; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: opacity 0.2s; white-space: nowrap;
  letter-spacing: -0.01em;
}
.btn-new-round:hover { opacity: 0.88; }

.hidden { display: none !important; }

/* ── Timer ───────────────────────────────────────────────────────────────── */
.timer-wrap {
  display: flex; align-items: center; gap: 6px;
  background: var(--glass, rgba(255,255,255,0.55));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border, rgba(8,17,46,0.1));
  box-shadow: inset 0 1px 0 var(--glass-hi, rgba(255,255,255,0.8));
  border-radius: 12px; padding: 4px 10px;
}
.timer-display {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--primary); letter-spacing: 1px; min-width: 44px; text-align: center;
}
.timer-display.running { color: var(--success); }
.timer-display.timer-urgent { color: var(--error); animation: timerPulse 0.8s ease-in-out infinite; }
.timer-display.timer-expired { color: var(--error); opacity: 0.5; }
@keyframes timerPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.timer-controls { display: flex; gap: 2px; }
.timer-btn {
  background: transparent; border: none; color: var(--muted);
  cursor: pointer; font-size: 13px; padding: 2px 4px;
  border-radius: 4px; transition: color 0.2s;
}
.timer-btn:hover { color: var(--text); }

.vote-tally { font-size: 13px; color: var(--primary); font-weight: 500; }

/* Ambient card layer — sits behind everything in the game screen */
.game-ambient {
  position: absolute; inset: 0; overflow: hidden;
  pointer-events: none; z-index: 0;
}

/* ── Game Body ───────────────────────────────────────────────────────────── */
.game-body {
  flex: 1; display: flex; overflow: hidden; position: relative; z-index: 1;
}

/* ── Sidebar tab — peeks from right edge to open the issues panel ── */
.sidebar-tab {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 8px;
  background: var(--glass, rgba(255,255,255,0.65));
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border, rgba(8,17,46,0.1));
  border-right: none;
  border-radius: 12px 0 0 12px;
  box-shadow: -2px 0 16px rgba(52,72,255,0.1), inset 1px 0 0 rgba(255,255,255,0.8);
  cursor: pointer;
  z-index: 5;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.15s;
}
.sidebar-tab:hover { background: rgba(255,255,255,0.92); }
.sidebar-tab span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
/* Slide left when sidebar opens */
.sidebar-tab.sidebar-open { right: 280px; }
.game-header { position: relative; z-index: 2; }
.picker-area  { position: relative; z-index: 1; }
