/* === Start Screen / Menu === */
.menu {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #0a0a0a;
  padding: 32px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Background effect */
.menu::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(229, 9, 20, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(51, 51, 255, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.menu > * {
  position: relative;
  z-index: 1;
}

/* === Glitch Title === */
.menu__title-container {
  margin-bottom: 8px;
}

.menu__icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
  animation: pulse 2s ease infinite;
}

.menu__title {
  font-size: 4rem;
  font-weight: 900;
  letter-spacing: 6px;
  color: #fff;
  position: relative;
  display: inline-block;
  text-transform: uppercase;
}

/* RGB split / glitch effect */
.menu__title::before,
.menu__title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.menu__title::before {
  color: #ff0000;
  z-index: -1;
  animation: glitch-1 3s infinite linear alternate-reverse;
}

.menu__title::after {
  color: #0000ff;
  z-index: -2;
  animation: glitch-2 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-1 {
  0%, 90%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
  92% { clip-path: inset(20% 0 60% 0); transform: translate(-3px, 1px); }
  94% { clip-path: inset(50% 0 20% 0); transform: translate(3px, -1px); }
  96% { clip-path: inset(70% 0 5% 0); transform: translate(-2px, 2px); }
  98% { clip-path: inset(10% 0 80% 0); transform: translate(2px, -2px); }
}

@keyframes glitch-2 {
  0%, 88%, 100% { clip-path: inset(0 0 0 0); transform: translate(0); }
  90% { clip-path: inset(40% 0 30% 0); transform: translate(3px, -1px); }
  93% { clip-path: inset(10% 0 70% 0); transform: translate(-3px, 1px); }
  95% { clip-path: inset(60% 0 10% 0); transform: translate(2px, 2px); }
  97% { clip-path: inset(5% 0 50% 0); transform: translate(-2px, -2px); }
}

.menu__subtitle {
  font-size: 1.5rem;
  font-weight: 300;
  letter-spacing: 12px;
  color: #888;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.menu__tagline {
  font-size: 16px;
  color: #666;
  font-style: italic;
  margin-bottom: 48px;
  max-width: 400px;
}

/* === Play Button === */
.menu__play-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 18px 48px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  background: #e50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.3s ease;
  margin-bottom: 32px;
}

.menu__play-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 30px rgba(229, 9, 20, 0.5), 0 0 60px rgba(229, 9, 20, 0.2);
}

.menu__play-btn:active {
  transform: scale(0.98);
}

/* Glow effect */
.menu__play-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.menu__play-btn:hover::after {
  opacity: 1;
}

/* === Secondary buttons === */
.menu__secondary {
  display: flex;
  gap: 24px;
  margin-bottom: 48px;
}

.menu__secondary-btn {
  background: none;
  border: 1px solid #333;
  color: #888;
  padding: 10px 24px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.menu__secondary-btn:hover {
  color: #fff;
  border-color: #666;
}

/* === Best Score === */
.menu__best {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid #222;
  border-radius: 8px;
  padding: 16px 32px;
  margin-bottom: 48px;
}

.menu__best-label {
  font-size: 13px;
  color: #555;
  margin-bottom: 4px;
}

.menu__best-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: 24px;
  font-weight: 700;
  color: var(--bill-color);
}

.menu__best-comment {
  font-size: 12px;
  color: #444;
  margin-top: 4px;
  font-style: italic;
}

/* === Footer === */
.menu__footer {
  color: #333;
  font-size: 12px;
}

.menu__footer a {
  color: #555;
  transition: color 0.2s;
}

.menu__footer a:hover {
  color: #888;
}

/* === How to Play Modal === */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9000;
  animation: fadeIn 0.2s ease;
}

.modal {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
}

.modal__body {
  color: #aaa;
  font-size: 14px;
  line-height: 1.8;
}

.modal__body ol {
  list-style: decimal;
  padding-left: 20px;
  margin-bottom: 16px;
}

.modal__body li {
  margin-bottom: 8px;
}

.modal__body strong {
  color: #ddd;
}

.modal__body .modal__tip {
  background: rgba(229, 9, 20, 0.1);
  border: 1px solid rgba(229, 9, 20, 0.2);
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 13px;
}

.modal__body .modal__controls {
  color: #666;
  margin-top: 12px;
  font-size: 13px;
  font-style: italic;
}

.modal__close {
  margin-top: 20px;
  width: 100%;
  padding: 12px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.modal__close:hover {
  background: #444;
}

/* === Level Select Modal === */
.level-select__list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.level-select__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #222;
  border-radius: 8px;
  border: 1px solid #333;
}

.level-select__item--locked {
  opacity: 0.4;
}

.level-select__name {
  font-size: 14px;
  color: #ddd;
}

.level-select__status {
  font-size: 12px;
  color: #666;
}

.level-select__best {
  font-family: 'Courier New', Courier, monospace;
  color: var(--bill-color);
  font-size: 13px;
}

/* === Level Intro Screen === */
.level-intro__badge {
  display: inline-block;
  background: rgba(229, 9, 20, 0.2);
  border: 1px solid rgba(229, 9, 20, 0.3);
  color: #e50914;
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.level-intro__company {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.level-intro__tagline {
  font-size: 14px;
  color: #666;
  font-style: italic;
  margin-bottom: 16px;
}

.level-intro__cost {
  font-family: 'Courier New', Courier, monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--bill-color);
  margin-bottom: 24px;
}

.level-intro__text {
  font-size: 15px;
  color: #aaa;
  line-height: 1.6;
  margin-bottom: 32px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.level-intro__start-btn {
  display: inline-block;
  padding: 16px 40px;
  font-size: 16px;
  font-weight: 700;
  background: #e50914;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.3s ease;
}

.level-intro__start-btn:hover {
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(229, 9, 20, 0.4);
}

.level-intro__loader {
  margin-top: 24px;
}

.level-intro__loader-bar {
  height: 3px;
  background: #e50914;
  border-radius: 2px;
  width: 0;
  margin-bottom: 12px;
}

.level-intro__loader-text {
  font-size: 13px;
  color: #555;
}

/* === Level Complete Screen === */
.level-complete {
  position: relative;
}

.level-complete__confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5001;
}

.confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  top: -10px;
  left: var(--x, 50vw);
  border-radius: 2px;
  animation: confetti-fall var(--duration, 2s) var(--delay, 0s) ease-in forwards;
  transform: rotate(var(--rotation, 0deg));
}

@keyframes confetti-fall {
  0% { top: -10px; opacity: 1; }
  100% { top: 110vh; opacity: 0; transform: rotate(calc(var(--rotation, 0deg) + 720deg)); }
}

.level-complete__title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 24px;
  color: var(--game-success);
}

.level-complete__bill {
  margin-bottom: 16px;
}

.level-complete__bill-label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 4px;
}

.level-complete__bill-amount {
  font-family: 'Courier New', Courier, monospace;
  font-size: 48px;
  font-weight: 700;
  color: var(--bill-color);
}

.level-complete__rating {
  margin-bottom: 24px;
}

.level-complete__stars {
  font-size: 32px;
  display: block;
  margin-bottom: 4px;
}

.level-complete__rating-label {
  font-size: 16px;
  color: #aaa;
  font-weight: 600;
}

.level-complete__stats {
  display: flex;
  gap: 32px;
  justify-content: center;
  margin-bottom: 24px;
}

.level-complete__stat {
  display: flex;
  flex-direction: column;
}

.level-complete__stat-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
}

.level-complete__stat-label {
  font-size: 11px;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.level-complete__signups {
  background: rgba(255, 170, 0, 0.1);
  border: 1px solid rgba(255, 170, 0, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 24px;
  text-align: left;
  font-size: 13px;
}

.level-complete__signups-title {
  color: var(--game-warning);
  font-weight: 600;
  margin-bottom: 6px;
}

.level-complete__signup-item {
  color: #aaa;
  padding: 2px 0;
}

.level-complete__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.level-complete__btn {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.2s;
}

.level-complete__btn:hover {
  opacity: 0.9;
}

.level-complete__btn:active {
  transform: scale(0.97);
}

.level-complete__btn--receipt {
  background: #e50914;
  color: #fff;
}

.level-complete__btn--retry {
  background: #333;
  color: #fff;
}

.level-complete__btn--menu {
  background: #222;
  color: #aaa;
  border: 1px solid #333;
}

/* === Receipt Screen === */
.receipt__paper {
  background: #f5f5e8;
  color: #222;
  font-family: 'Courier New', Courier, monospace;
  padding: 32px 24px;
  border-radius: 4px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  max-width: 400px;
  margin: 0 auto;
  text-align: left;
}

.receipt__header {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.receipt__divider {
  border: none;
  border-top: 1px dashed #999;
  margin: 12px 0;
}

.receipt__divider--double {
  border-top: 2px double #666;
}

.receipt__charges {
  font-size: 12px;
}

.receipt__line {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.receipt__line--signup {
  color: #c00;
}

.receipt__total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  padding: 4px 0;
}

.receipt__total-amount {
  color: #c00;
}

.receipt__rating {
  text-align: center;
  padding: 8px 0;
}

.receipt__stars {
  font-size: 24px;
  display: block;
}

.receipt__rating-label {
  font-size: 14px;
  font-weight: 600;
}

.receipt__stats {
  text-align: center;
  font-size: 11px;
  color: #666;
  padding: 4px 0;
}

.receipt__signups {
  text-align: center;
  font-size: 12px;
  color: #c00;
  padding: 4px 0;
}

.receipt__commentary {
  text-align: center;
  font-size: 11px;
  color: #888;
  font-style: italic;
  padding: 8px 0;
}

.receipt__share-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: #222;
  color: #fff;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin: 8px 0;
  transition: background 0.2s;
}

.receipt__share-btn:hover {
  background: #333;
}

.receipt__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.receipt__action-btn {
  flex: 1;
  padding: 10px;
  background: #ddd;
  color: #222;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.receipt__action-btn:hover {
  background: #ccc;
}

.receipt__footer {
  text-align: center;
  margin-top: 16px;
  padding-top: 8px;
}

.receipt__tagline {
  font-size: 10px;
  color: #888;
  font-style: italic;
  margin-bottom: 8px;
}

.receipt__branding {
  font-size: 11px;
  color: #aaa;
}

.receipt__url {
  font-size: 10px;
  color: #bbb;
}

/* Copy toast */
.copy-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 10px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  z-index: 10001;
}

.copy-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Mobile === */
@media (max-width: 480px) {
  .menu__title {
    font-size: 2.5rem;
    letter-spacing: 3px;
  }

  .menu__subtitle {
    font-size: 1rem;
    letter-spacing: 6px;
  }

  .menu__tagline {
    font-size: 14px;
  }

  .menu__play-btn {
    padding: 16px 36px;
    font-size: 16px;
  }

  .menu__secondary {
    flex-direction: column;
    gap: 12px;
  }

  .level-complete__bill-amount {
    font-size: 36px;
  }

  .level-complete__stats {
    gap: 20px;
  }

  .receipt__paper {
    padding: 24px 16px;
  }
}
