:root {
  color: #1f2933;
  background: #d6e4f2;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  background: #d6e4f2;
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid #7c8fa3;
  border-radius: 3px;
  background: #fff2a6;
  color: #1f2933;
  cursor: pointer;
  font-weight: 650;
  max-width: 100%;
  padding: 0.7rem 0.95rem;
  transition:
    transform 120ms ease,
    background 120ms ease;
}

button:hover,
button:focus-visible {
  background: #ffe481;
  outline: 3px solid #f4c542;
  outline-offset: 2px;
}

input[type="text"] {
  background: #ffffff;
  border: 1px solid #9aaec2;
  border-radius: 2px;
  padding: 0.65rem 0.75rem;
}

input[type="range"] {
  accent-color: #6f8ba7;
  width: 100%;
}

.app {
  align-items: center;
  display: grid;
  justify-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1rem, 4vw, 2.5rem);
  place-items: center;
  width: 100%;
}

.screen {
  margin: 0 auto;
  max-width: 860px;
  width: 100%;
}

.access-window {
  background: #edf3f9;
  border: 1px solid #6f8ba7;
  border-radius: 4px;
  box-shadow:
    0 18px 42px rgba(32, 54, 76, 0.24),
    0 2px 0 rgba(255, 255, 255, 0.75) inset;
  overflow: hidden;
}

.access-titlebar {
  align-items: center;
  background: #b8cde1;
  border-bottom: 1px solid #7896b4;
  color: #1f2933;
  display: flex;
  font-size: 0.82rem;
  font-weight: 650;
  justify-content: space-between;
  min-height: 2rem;
  padding: 0.35rem 0.7rem;
}

.access-titlebar__controls {
  color: #34495c;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0.18rem;
}

.access-ribbon {
  align-items: end;
  background: #dbe8f4;
  border-bottom: 1px solid #9db4ca;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  min-height: 3.25rem;
  padding: 0.5rem 0.65rem 0;
}

.access-ribbon__tab {
  border: 1px solid transparent;
  border-bottom: 0;
  color: #2f4356;
  font-size: 0.78rem;
  padding: 0.45rem 0.7rem 0.55rem;
}

.access-ribbon__tab--active {
  background: #f8fbff;
  border-color: #9db4ca;
  border-radius: 3px 3px 0 0;
  color: #1f2933;
  font-weight: 700;
}

.access-workspace {
  background:
    linear-gradient(#ffffff 0 0) padding-box,
    repeating-linear-gradient(
      90deg,
      rgba(111, 139, 167, 0.08) 0,
      rgba(111, 139, 167, 0.08) 1px,
      transparent 1px,
      transparent 64px
    );
  padding: clamp(1rem, 3vw, 1.75rem);
}

.screen__header {
  margin-bottom: 1.25rem;
}

.screen__eyebrow {
  color: #4d647a;
  font-size: 0.84rem;
  font-weight: 650;
  margin: 0 0 0.45rem;
}

.screen__title {
  font-size: 2rem;
  line-height: 1.18;
  margin: 0;
}

.screen__subtitle {
  color: #3f4f5d;
  font-size: 1rem;
  line-height: 1.55;
  margin: 0.85rem 0 0;
  max-width: 38rem;
}

.panel {
  background: #fffefa;
  border: 1px solid #b8c4d0;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(42, 64, 84, 0.12);
  padding: clamp(1rem, 3vw, 1.4rem);
}

.form-panel {
  transition:
    background-color 400ms ease,
    border-color 400ms ease,
    box-shadow 400ms ease;
}

.form-panel--penalty {
  animation: form-penalty-red 10s linear forwards;
}

.stack {
  display: grid;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span {
  color: #3f4f5d;
  font-size: 0.92rem;
}

.choice {
  align-items: center;
  display: flex;
  gap: 0.6rem;
}

.feedback {
  background: #eef5fb;
  border-left: 4px solid #6f8ba7;
  color: #33383f;
  margin: 0;
  padding: 0.85rem 1rem;
}

.penalty-countdown {
  background: #fff0f0;
  border-left: 4px solid #c73b3b;
  color: #7f1d1d;
  font-weight: 700;
  margin: 0;
  padding: 0.85rem 1rem;
}

.selected-value {
  color: #2f4356;
  font-size: 0.95rem;
  margin: 0;
}

@keyframes form-penalty-red {
  0% {
    background-color: #fffefa;
    border-color: #b8c4d0;
    box-shadow: 0 1px 3px rgba(42, 64, 84, 0.12);
  }

  100% {
    background-color: #ffe0e0;
    border-color: #c73b3b;
    box-shadow: 0 0 0 3px rgba(199, 59, 59, 0.16);
  }
}

.escape-zone {
  background: #f8fbff;
  border: 1px dashed #7c8fa3;
  border-radius: 3px;
  height: clamp(260px, 44vh, 340px);
  overflow: hidden;
  position: relative;
}

.escape-button {
  max-width: calc(100% - 1rem);
  min-width: min(17rem, calc(100% - 1rem));
  position: absolute;
  white-space: normal;
}

.escape-button--shaking {
  animation: escape-shake 160ms steps(2, end) infinite;
}

@keyframes escape-shake {
  0% {
    transform: translate(0, 0);
  }

  25% {
    transform: translate(-2px, 1px);
  }

  50% {
    transform: translate(2px, -1px);
  }

  75% {
    transform: translate(-1px, -2px);
  }

  100% {
    transform: translate(1px, 2px);
  }
}

.assistant-panel {
  background: #f8fbff;
  border: 2px solid #6f8ba7;
  border-radius: 3px;
  color: #1f2933;
  padding: 1rem;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
}

.tic-tac-toe-panel {
  align-items: start;
}

.tic-tac-toe-board {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(3, 1fr);
  width: min(100%, 20rem);
}

.tic-tac-toe-cell {
  aspect-ratio: 1;
  background: #ffffff;
  font-size: clamp(1.7rem, 9vw, 3rem);
  line-height: 1;
  min-width: 0;
  padding: 0;
}

.tic-tac-toe-cell--x {
  background: #e7f4ee;
  color: #1f6f50;
}

.tic-tac-toe-cell--o {
  background: #f6e9ee;
  color: #8a2846;
}

.tic-tac-toe-cell:disabled {
  cursor: default;
  opacity: 1;
}

.tic-tac-toe-message {
  white-space: pre-line;
}

.cat-retention {
  align-items: start;
}

.cat-retention__intro {
  color: #2f4356;
  display: grid;
  font-weight: 700;
  gap: 0.25rem;
}

.cat-retention__intro p {
  margin: 0;
}

.cat-figure {
  background: #f8fbff;
  border: 1px solid #9db4ca;
  border-radius: 3px;
  margin: 0;
  max-width: 18rem;
  overflow: hidden;
  width: 100%;
}

.cat-figure__image {
  display: block;
  height: auto;
  width: 100%;
}

.cat-message {
  white-space: pre-line;
}

.cat-time-wasted {
  color: #4d647a;
  font-size: 0.9rem;
  font-weight: 650;
  margin: 0;
}

.cat-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.cat-continue-link {
  color: #365f85;
  font-size: 0.88rem;
  text-decoration: underline;
  text-underline-offset: 0.18rem;
}

.cat-continue-link:hover,
.cat-continue-link:focus-visible {
  color: #1f2933;
  outline: 3px solid #f4c542;
  outline-offset: 3px;
}

.secondary-button {
  background: #ffffff;
  font-weight: 600;
}

.quiet-button {
  background: transparent;
  border-style: dashed;
  font-weight: 600;
}

.win-panel {
  overflow: hidden;
  position: relative;
}

.win-panel > :not(.win-firework) {
  position: relative;
  z-index: 1;
}

.win-firework {
  animation: win-firework-spark 1200ms ease-out both;
  background:
    radial-gradient(circle, #fff2a6 0 0.18rem, transparent 0.2rem),
    linear-gradient(0deg, transparent 46%, #f4c542 46% 54%, transparent 54%),
    linear-gradient(45deg, transparent 46%, #d24b68 46% 54%, transparent 54%),
    linear-gradient(90deg, transparent 46%, #6f8ba7 46% 54%, transparent 54%),
    linear-gradient(135deg, transparent 46%, #1f6f50 46% 54%, transparent 54%);
  border-radius: 50%;
  height: 4.25rem;
  opacity: 0.78;
  pointer-events: none;
  position: absolute;
  left: var(--firework-left);
  top: var(--firework-top);
  transform: translate(-50%, -50%) scale(0.72);
  transform-origin: center;
  width: 4.25rem;
  z-index: 0;
}

@keyframes win-firework-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(-8deg);
  }

  62% {
    opacity: 0.82;
    transform: translate(-50%, -50%) scale(0.82) rotate(4deg);
  }

  100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(0.72) rotate(0deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .win-firework {
    animation: none;
  }
}
