@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@400;500;700;800;900&display=swap');

:root {
  --bg: #09090b;
  --panel: #121214;
  --panel-2: #17171a;
  --panel-3: #1e1e22;
  --line: #26262b;
  --text: #f4f4f5;
  --muted: #8a8a93;
  --dim: #5c5c65;
  --good: #34d399;
  --bad: #f87171;
  --accent: #ffffff;
  --accent-gold: #facc15;
  --accent-red: #ef4444;
  --accent-blue: #3b82f6;
  --radius: 14px;
  --radius-sm: 10px;
  --font: 'Heebo', sans-serif;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100dvh;
  min-height: 100vh;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

#app {
  max-width: 620px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: max(60px, env(safe-area-inset-bottom) + 60px);
  position: relative;
  z-index: 1;
}

/* Background Layers */
.bg-layer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.5s ease;
  background-size: cover;
  background-position: center;
}

.bg-layer.is-active {
  opacity: 1;
}

.bg-layer--knesset {
  background-image: linear-gradient(180deg, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.82) 30%, rgba(9, 9, 11, 0.88) 70%, rgba(9, 9, 11, 0.98) 100%), url('../assets/bg_knesset.jpg');
}

.bg-layer--studio {
  background-image: linear-gradient(180deg, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.82) 30%, rgba(9, 9, 11, 0.88) 70%, rgba(9, 9, 11, 0.98) 100%), url('../assets/bg_studio.jpg');
}

.bg-layer--protest {
  background-image: linear-gradient(180deg, rgba(9, 9, 11, 0.95) 0%, rgba(9, 9, 11, 0.82) 30%, rgba(9, 9, 11, 0.88) 70%, rgba(9, 9, 11, 0.98) 100%), url('../assets/bg_protest.jpg');
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  background: rgba(9, 9, 11, 0.8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Hide header on start screen to avoid duplicate title */
body:has(#screen-start.is-active) .app-header {
  display: none;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.logo {
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
  margin: 0;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-red);
}

.live-dot {
  width: 7px;
  height: 7px;
  background-color: var(--accent-red);
  border-radius: 50%;
  animation: blink 2s infinite;
}

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

/* Screens */
.screen {
  display: none;
  animation: fade-up 0.35s ease-out;
}

.screen.is-active {
  display: block;
}

/* Home / Start Screen (Mobile-First) */
.home {
  min-height: calc(100dvh - 56px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 8px max(24px, env(safe-area-inset-bottom));
  text-align: center;
}

.home__top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.home__top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home__body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 8px;
}

.home__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  color: var(--accent-gold);
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.home__title {
  font-size: clamp(38px, 10vw, 60px);
  font-weight: 900;
  line-height: 1.08;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.9);
}

.title-highlight {
  background: linear-gradient(135deg, #ffffff 0%, var(--accent-gold) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.home__sub {
  font-size: 1.02rem;
  color: #e4e4e7;
  line-height: 1.6;
  max-width: 440px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

.home__actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  min-height: 52px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 1rem;
  font-family: inherit;
  background: var(--accent);
  color: #000;
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--spring), opacity 0.2s ease, background 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn:hover {
  opacity: 0.92;
}

.btn--primary {
  background: #ffffff;
  color: #000000;
  font-weight: 800;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.btn--primary:hover {
  background: #f4f4f5;
}

.btn--glass {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #ffffff;
  font-weight: 700;
}

.btn--glass:hover, .btn--glass:active {
  background: rgba(255, 255, 255, 0.16);
}

.btn--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--line);
}

.btn--ghost:hover, .btn--ghost:active {
  background: var(--panel-2);
}

.btn--danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn--block {
  width: 100%;
}

.btn--large {
  min-height: 56px;
  font-size: 1.12rem;
}

.btn--small {
  min-height: 38px;
  padding: 8px 18px;
  font-size: 0.85rem;
}

.btn-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 1.15rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn-circle:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.15);
}

/* Panels */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

/* Stats Bar */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-progress-bg {
  height: 4px;
  background: var(--panel-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.stat-progress-fill {
  height: 100%;
  background: var(--accent-gold);
  border-radius: 999px;
  transition: width 0.5s var(--spring);
}

/* Stats Pills */
.pill--good, .pill--bad {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.pill--good {
  background: rgba(52, 211, 153, 0.15);
  color: var(--good);
}

.pill--bad {
  background: rgba(248, 113, 113, 0.15);
  color: var(--bad);
}

/* Turn Progress Dots */
.turn-progress {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 20px 0;
}

.turn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--panel-3);
  transition: background 0.3s ease;
}

.turn-dot.is-active {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Ticker */
.news-ticker, .ticker {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: linear-gradient(90deg, #991b1b, #dc2626, #991b1b);
  color: white;
  display: flex;
  align-items: center;
  overflow: hidden;
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: content-box;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.6);
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.ticker-label {
  background: #09090b;
  color: var(--accent-red);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 999px;
  margin-right: 10px;
  margin-left: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.ticker-content {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

#ticker-text {
  font-size: 0.86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-left: 12px;
  padding-right: 4px;
  display: block;
  width: 100%;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.3s ease, transform 0.3s var(--spring);
}

#ticker-text.ticker-exit {
  opacity: 0;
  transform: translateY(-14px);
}

#ticker-text.ticker-enter {
  opacity: 0;
  transform: translateY(14px);
}

/* Dialogs */
dialog {
  margin: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  padding: 20px;
  max-width: 92vw;
  width: 440px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.7);
  direction: rtl;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fade-up 0.2s ease-out;
}

dialog[open] {
  animation: spring-in 0.4s var(--spring);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
}

.dialog-close {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dialog-close:hover {
  background: var(--panel-3);
  color: var(--text);
}

/* Careers & Achievements Tabs */
.careers-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--panel-2);
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.careers-tab {
  flex: 1;
  padding: 8px 16px;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.careers-tab[aria-pressed="true"] {
  background: var(--accent);
  color: #000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Toast */
.toast-container {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  inset-inline: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  z-index: 60;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #18181bf5;
  border: 1px solid #34d39955;
  box-shadow: 0 10px 30px #00000080;
  animation: toast-in 0.42s var(--spring);
  color: var(--text);
  font-weight: 500;
  font-size: 0.9rem;
}

.toast.is-leaving {
  animation: toast-out 0.3s ease-in forwards;
}

/* Utilities */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  display: inline-block;
  position: relative;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: 0;
  width: 40%;
  height: 3px;
  background: var(--accent-red);
  border-radius: 2px;
}

.analyst-comment {
  background: var(--panel-2);
  border-right: 3px solid var(--accent-gold);
  padding: 16px;
  border-radius: var(--radius-sm);
  font-style: italic;
  color: var(--muted);
  line-height: 1.5;
  margin: 16px 0;
}

.fade-up {
  animation: fade-up 0.35s ease-out;
}

/* Animations */
@keyframes fade-up {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes spring-in {
  0% { opacity: 0; transform: scale(0.85) translateY(14px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateY(-20px) scale(0.9); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.9); }
}

@keyframes ticker-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@keyframes confetti-fall {
  0% { transform: translateY(-10vh) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(360deg); }
}

/* Party Selection Screen */
.party-header-box {
  text-align: center;
  margin-bottom: 20px;
}

.party-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.party-screen-title {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.party-screen-sub {
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 14px;
}

.party-candidate-preview {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--text);
  display: inline-block;
  max-width: 100%;
}

.parties-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.party-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: all 0.22s var(--spring);
  position: relative;
  overflow: hidden;
}

.party-card:hover, .party-card:active {
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
  background: var(--panel-2);
}

.party-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.party-card__main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.party-card__icon {
  font-size: 2rem;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.party-card__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.party-card__name {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.party-card__slogan {
  font-size: 0.85rem;
  color: var(--muted);
}

.party-card__desc {
  font-size: 0.85rem;
  color: #a1a1aa;
  line-height: 1.4;
}

.party-card__bonus {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--good);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 999px;
  padding: 4px 10px;
  width: fit-content;
}

.party-card__btn {
  margin-top: 4px;
  min-height: 44px;
  font-size: 0.95rem;
}

/* Rejection / Accepted Dialogs */
.party-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  max-width: 440px;
  width: 90vw;
  padding: 24px;
}

.party-dialog::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.rejection-card, .accepted-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.rejection-icon, .accepted-icon {
  font-size: 3.5rem;
  line-height: 1;
  animation: spring-in 0.5s var(--spring);
}

.rejection-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--accent-red);
  margin: 0;
}

.accepted-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--good);
  margin: 0;
}

.rejection-badge {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.accepted-party-badge {
  background: rgba(52, 211, 153, 0.15);
  color: var(--good);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 800;
}

.rejection-reason, .accepted-welcome {
  font-size: 1.05rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  padding: 14px;
  border-radius: var(--radius-sm);
  text-align: right;
  width: 100%;
}

.accepted-bonus-info {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(250, 204, 21, 0.1);
  border: 1px solid rgba(250, 204, 21, 0.25);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  width: 100%;
}


/* Dilemma Lottery Spinner Overlay */
.dilemma-lottery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  animation: fade-up 0.25s ease-out;
}

.lottery-spinner-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 18px;
  text-align: center;
  max-width: 360px;
  width: 90vw;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lottery-spinner-badge {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-gold);
  background: rgba(250, 204, 21, 0.12);
  border: 1px solid rgba(250, 204, 21, 0.3);
  padding: 4px 14px;
  border-radius: 999px;
}

.lottery-spinner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.lottery-spinner-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.lottery-spinner-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.lottery-spinner-num {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.1;
  font-family: monospace, var(--font);
  transition: transform 0.15s ease;
}

.lottery-spinner-num.is-rolling {
  color: var(--accent-gold);
  animation: pulse-num 0.12s infinite alternate;
}

.lottery-spinner-num.is-landed-pos {
  color: var(--good);
  transform: scale(1.12);
}

.lottery-spinner-num.is-landed-neg {
  color: var(--accent-red);
  transform: scale(1.12);
}

.lottery-spinner-num.is-landed-zero {
  color: var(--muted);
  transform: scale(1.05);
}

.lottery-spinner-item-sub {
  font-size: 0.75rem;
  color: var(--dim);
}

.lottery-spinner-rank-pill {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
}

.lottery-spinner-rank-pill--up {
  background: rgba(52, 211, 153, 0.15);
  color: var(--good);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.lottery-spinner-rank-pill--down {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.lottery-spinner-sub {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.4;
}

@keyframes pulse-num {
  0% { transform: scale(0.95); }
  100% { transform: scale(1.05); }
}

/* Desktop Enhancements */
@media (min-width: 900px) {
  #app {
    max-width: 800px;
  }
}
