.thecode-game {
  --tcg-paper: #fffdf8;
  --tcg-paper-strong: #fffefc;
  --tcg-ink: #1f2937;
  --tcg-muted: #6b7280;
  --tcg-accent: #7eb38f;
  --tcg-accent-strong: #5e9770;
  --tcg-accent-soft: rgba(126, 179, 143, 0.18);
  --tcg-line: rgba(126, 179, 143, 0.42);
  --tcg-border: rgba(31, 41, 55, 0.08);
  --tcg-shadow: 0 26px 60px rgba(31, 41, 55, 0.14);
  --tcg-success: #2f8f5b;
  --tcg-error: #d34a58;
  color: var(--tcg-ink);
  font-family: inherit;
}

.thecode-game,
.thecode-game * {
  box-sizing: border-box;
}

.thecode-game__card {
  position: relative;
  overflow: hidden;
  width: min(100%, 980px);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 42px);
  border: 1px solid var(--tcg-border);
  border-radius: 30px;
  background:
    radial-gradient(circle at top left, rgba(126, 179, 143, 0.16), transparent 28%),
    linear-gradient(180deg, var(--tcg-paper) 0%, var(--tcg-paper-strong) 100%);
  box-shadow: var(--tcg-shadow);
}

.thecode-game__card::before {
  content: "";
  position: absolute;
  inset: 18px auto 18px 16px;
  width: 18px;
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(31, 41, 55, 0.75) 0 36%, transparent 37%) center top / 100% 56px repeat-y;
  opacity: 0.14;
  pointer-events: none;
}

.thecode-game__header {
  position: relative;
  z-index: 1;
  margin-bottom: 30px;
  padding-left: clamp(6px, 1vw, 12px);
  text-align: center;
}

.thecode-game__card--intro {
  width: min(100%, 760px);
}

.thecode-game__intro {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  justify-items: center;
  text-align: center;
}

.thecode-game__intro--countdown {
  gap: 18px;
  min-height: 360px;
  align-content: center;
}

.thecode-game__intro-panel {
  width: min(100%, 620px);
  padding: 24px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(126, 179, 143, 0.18);
}

.thecode-game__intro-title {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tcg-accent-strong);
}

.thecode-game__intro-rules {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
  text-align: left;
}

.thecode-game__intro-rules li {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(126, 179, 143, 0.08);
  font-size: 0.96rem;
  line-height: 1.5;
  font-weight: 700;
}

.thecode-game__intro-note {
  margin: 16px 0 0;
  color: var(--tcg-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.thecode-game__intro-actions {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.thecode-game__countdown {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(124px, 18vw, 170px);
  height: clamp(124px, 18vw, 170px);
  border-radius: 999px;
  border: 2px solid rgba(126, 179, 143, 0.28);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.95), rgba(126, 179, 143, 0.18)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(126, 179, 143, 0.14));
  box-shadow:
    0 18px 40px rgba(31, 41, 55, 0.12),
    inset 0 2px 10px rgba(255, 255, 255, 0.65);
  color: var(--tcg-ink);
  font-size: clamp(3rem, 9vw, 4.6rem);
  font-weight: 900;
  letter-spacing: -0.06em;
  animation: tcgCountdownPulse 1s ease-in-out infinite;
}

.thecode-game__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--tcg-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--tcg-accent-strong);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.thecode-game__title {
  margin: 16px 0 10px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.thecode-game__subtitle {
  max-width: 560px;
  margin: 0 auto;
  color: var(--tcg-muted);
  font-size: 1rem;
  line-height: 1.6;
}

.thecode-game__layout {
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.95fr);
  align-items: start;
}

.thecode-game__clues {
  display: grid;
  gap: 16px;
}

.thecode-game__clue {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  align-items: center;
  padding: 16px 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(126, 179, 143, 0.14);
}

.thecode-game__guess {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.thecode-game__guess--numbers {
  flex-wrap: nowrap;
}

.thecode-game__digit-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 68px;
  border: 2px solid var(--tcg-line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(126, 179, 143, 0.05));
  border-radius: 16px;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.thecode-game__color-token {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 58px;
}

.thecode-game__color-label {
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.thecode-game__swatch {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--tcg-swatch, #ccc);
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.35),
    0 10px 20px rgba(31, 41, 55, 0.12);
  border: 2px solid rgba(255, 255, 255, 0.95);
}

.thecode-game__clue-text {
  margin: 0;
  font-size: clamp(1rem, 1.4vw, 1.28rem);
  line-height: 1.45;
  font-weight: 700;
}

.thecode-game__sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 18px;
}

.thecode-game__note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(126, 179, 143, 0.18);
  color: var(--tcg-muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.thecode-game__note-icon {
  flex: 0 0 auto;
  color: var(--tcg-accent-strong);
}

.thecode-game__lock {
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.thecode-game__lock svg {
  width: min(100%, 188px);
  height: auto;
}

.thecode-game__answer-card {
  padding: 20px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(126, 179, 143, 0.18);
}

.thecode-game__answer-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.thecode-game__answer-subtitle {
  margin: 0 0 16px;
  color: var(--tcg-muted);
  font-size: 0.94rem;
  line-height: 1.45;
}

.thecode-game__status-bar {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.thecode-game__attempts {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(126, 179, 143, 0.18);
  background: rgba(126, 179, 143, 0.08);
  color: var(--tcg-accent-strong);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.4;
}

.thecode-game__attempts.is-empty {
  color: var(--tcg-error);
  border-color: rgba(211, 74, 88, 0.2);
  background: rgba(211, 74, 88, 0.08);
}

.thecode-game__timer {
  margin: 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(31, 41, 55, 0.08);
  background: rgba(31, 41, 55, 0.04);
  color: var(--tcg-ink);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.4;
  text-align: right;
}

.thecode-game__timer.is-warning {
  color: #b86b1d;
  border-color: rgba(184, 107, 29, 0.22);
  background: rgba(244, 173, 87, 0.14);
}

.thecode-game__timer.is-empty {
  color: var(--tcg-error);
  border-color: rgba(211, 74, 88, 0.2);
  background: rgba(211, 74, 88, 0.08);
}

.thecode-game__answer-inputs {
  display: flex;
  gap: 10px;
}

.thecode-game__answer-inputs--numbers {
  justify-content: center;
}

.thecode-game__answer-inputs--colors {
  justify-content: center;
}

.thecode-game__input {
  width: 62px;
  height: 70px;
  padding: 0;
  border: 2px solid var(--tcg-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--tcg-ink);
  font: inherit;
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  outline: none;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.thecode-game__input:focus {
  border-color: var(--tcg-accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 0 0 5px rgba(126, 179, 143, 0.12);
}

.thecode-game__input[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
}

.thecode-game__color-slot {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 88px;
  min-height: 104px;
  padding: 12px 10px;
  border: 2px solid var(--tcg-line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.thecode-game__color-slot:hover,
.thecode-game__color-slot:focus-visible {
  border-color: var(--tcg-accent-strong);
  transform: translateY(-2px);
  box-shadow: 0 0 0 5px rgba(126, 179, 143, 0.12);
  outline: none;
}

.thecode-game__color-slot[disabled] {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.thecode-game__color-slot-name {
  min-height: 1.2em;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--tcg-muted);
  text-align: center;
}

.thecode-game__helper {
  margin: 12px 0 0;
  color: var(--tcg-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.thecode-game__palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.thecode-game__palette-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(126, 179, 143, 0.08);
  color: var(--tcg-muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.thecode-game__palette-item .thecode-game__swatch {
  width: 18px;
  height: 18px;
  box-shadow: none;
}

.thecode-game__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.thecode-game__button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
}

.thecode-game__button:hover,
.thecode-game__button:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.thecode-game__button--primary {
  background: var(--tcg-ink);
  color: #fff;
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.18);
}

.thecode-game__button--secondary {
  background: rgba(126, 179, 143, 0.12);
  color: var(--tcg-accent-strong);
}

.thecode-game__button[disabled] {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.thecode-game__feedback {
  min-height: 1.5em;
  margin: 14px 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 700;
}

.thecode-game__feedback.is-success {
  color: var(--tcg-success);
}

.thecode-game__feedback.is-error {
  color: var(--tcg-error);
}

.thecode-game__reveal {
  margin-top: 18px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(126, 179, 143, 0.08);
  border: 1px solid rgba(126, 179, 143, 0.18);
}

.thecode-game__reveal[hidden] {
  display: none;
}

.thecode-game__reveal-title {
  margin: 0 0 8px;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--tcg-accent-strong);
}

.thecode-game__reveal-solution {
  margin: 0 0 14px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.45;
}

.thecode-game__reveal-list {
  display: grid;
  gap: 10px;
}

.thecode-game__reveal-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(126, 179, 143, 0.16);
}

.thecode-game__reveal-item-title {
  margin: 0 0 6px;
  font-size: 0.95rem;
  font-weight: 800;
}

.thecode-game__reveal-item-text {
  margin: 0;
  color: var(--tcg-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

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

@keyframes tcgCountdownPulse {
  0% {
    transform: scale(0.92);
    box-shadow:
      0 12px 28px rgba(31, 41, 55, 0.08),
      inset 0 2px 10px rgba(255, 255, 255, 0.65);
  }

  50% {
    transform: scale(1);
    box-shadow:
      0 24px 44px rgba(31, 41, 55, 0.16),
      inset 0 2px 12px rgba(255, 255, 255, 0.72);
  }

  100% {
    transform: scale(0.92);
    box-shadow:
      0 12px 28px rgba(31, 41, 55, 0.08),
      inset 0 2px 10px rgba(255, 255, 255, 0.65);
  }
}

@media (max-width: 900px) {
  .thecode-game__layout {
    grid-template-columns: 1fr;
  }

  .thecode-game__sidebar {
    position: static;
  }
}

@media (max-width: 640px) {
  .thecode-game__card {
    padding: 22px 18px 20px;
    border-radius: 24px;
  }

  .thecode-game__card::before {
    display: none;
  }

  .thecode-game__clue {
    grid-template-columns: 1fr;
  }

  .thecode-game__guess {
    justify-content: flex-start;
  }

  .thecode-game__digit-box {
    width: 48px;
    height: 58px;
    font-size: 1.7rem;
  }

  .thecode-game__countdown {
    width: 122px;
    height: 122px;
    font-size: 3.2rem;
  }

  .thecode-game__status-bar {
    grid-template-columns: 1fr;
  }

  .thecode-game__timer {
    text-align: left;
  }

  .thecode-game__input {
    width: 52px;
    height: 60px;
    font-size: 1.65rem;
  }

  .thecode-game__color-slot {
    width: calc(33.333% - 7px);
    min-width: 0;
    min-height: 96px;
  }
}
