:root {
  color: #20231f;
  background: #f6f7f2;
  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 {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.86), transparent 36rem),
    #f6f7f2;
}

button {
  font: inherit;
}

.game-shell {
  --status-accent: #278a70;
  display: grid;
  min-height: 100vh;
  padding: 28px;
  place-items: center;
}

.game-panel {
  width: min(100%, 1040px);
  padding: 28px 34px 24px;
  border: 1px solid rgba(32, 35, 31, 0.14);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 22px 60px rgba(32, 35, 31, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.game-header {
  display: grid;
  grid-template-columns: 92px auto 92px;
  align-items: center;
  justify-content: center;
  column-gap: 18px;
  text-align: center;
}

.game-header h1 {
  margin: 0;
  color: #182230;
  font-size: 3.35rem;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(32, 35, 31, 0.08);
}

.game-header p {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  color: #4f5d70;
  font-size: 1.22rem;
  line-height: 1.35;
}

.circuit-line {
  position: relative;
  height: 20px;
}

.circuit-line::before {
  position: absolute;
  top: 9px;
  right: 11px;
  width: 58px;
  height: 12px;
  border-top: 2px solid #55c7bd;
  border-left: 2px solid #55c7bd;
  content: "";
}

.circuit-line::after,
.circuit-line-right::after {
  position: absolute;
  top: 4px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #55c7bd;
  box-shadow: -66px 0 0 #55c7bd;
  content: "";
}

.circuit-line::after {
  right: 0;
}

.circuit-line-right {
  transform: scaleX(-1);
}

.game-divider {
  height: 1px;
  margin: 18px 0 24px;
  background: rgba(32, 35, 31, 0.16);
}

.game-top {
  display: grid;
  grid-template-columns: minmax(330px, 0.92fr) minmax(420px, 1fr);
  gap: 34px;
  align-items: center;
}

.agent-stage {
  position: relative;
  display: grid;
  min-height: 330px;
  place-items: center;
}

.agent-stage::after {
  position: absolute;
  right: 16%;
  bottom: 16px;
  left: 16%;
  height: 34px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-accent) 20%, transparent);
  filter: blur(10px);
  content: "";
}

.agent-sparkles {
  position: absolute;
  inset: 14px 20px;
  pointer-events: none;
}

.agent-sparkles span {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--status-accent) 44%, transparent);
}

.agent-sparkles span:nth-child(1) {
  top: 35%;
  left: 10%;
  transform: rotate(45deg);
}

.agent-sparkles span:nth-child(1)::before,
.agent-sparkles span:nth-child(4)::before {
  position: absolute;
  inset: -8px 3px;
  border-radius: 999px;
  background: inherit;
  content: "";
}

.agent-sparkles span:nth-child(1)::after,
.agent-sparkles span:nth-child(4)::after {
  position: absolute;
  inset: 3px -8px;
  border-radius: 999px;
  background: inherit;
  content: "";
}

.agent-sparkles span:nth-child(2) {
  top: 58%;
  left: 5%;
}

.agent-sparkles span:nth-child(3) {
  top: 17%;
  right: 21%;
}

.agent-sparkles span:nth-child(4) {
  right: 9%;
  bottom: 35%;
  transform: rotate(45deg);
}

.agent-sparkles span:nth-child(5) {
  right: 13%;
  bottom: 18%;
}

.agent {
  position: relative;
  z-index: 1;
  display: grid;
  width: 250px;
  height: 306px;
  place-items: end center;
  transform-origin: 50% 100%;
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.agent-antenna {
  position: absolute;
  top: 0;
  width: 8px;
  height: 56px;
  border-radius: 999px;
  background: var(--status-accent);
  box-shadow: 0 2px 0 rgba(32, 35, 31, 0.12);
}

.agent-antenna::after {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 36px;
  height: 36px;
  border: 6px solid var(--status-accent);
  border-radius: 999px;
  background: #f6f7f2;
  content: "";
  transform: translateX(-50%);
}

.agent-body {
  position: relative;
  display: grid;
  width: 220px;
  height: 260px;
  padding-top: 68px;
  border: 5px solid var(--status-accent);
  border-radius: 96px 96px 70px 70px;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.5) 38%, transparent 39%),
    linear-gradient(155deg, #ffffff 0%, #fbfefc 45%, #eef4ed 100%);
  box-shadow:
    0 0 0 10px color-mix(in srgb, var(--status-accent) 14%, transparent),
    0 24px 38px rgba(32, 35, 31, 0.18),
    inset 0 -18px 26px rgba(32, 35, 31, 0.05);
  justify-items: center;
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.agent-face {
  position: relative;
  width: 156px;
  height: 94px;
  border: 4px solid rgba(0, 0, 0, 0.2);
  border-radius: 38px;
  background:
    radial-gradient(circle at 28% 24%, rgba(34, 104, 100, 0.55), transparent 34%),
    #062f32;
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.36),
    0 8px 18px rgba(32, 35, 31, 0.13);
  transition: transform 180ms ease;
}

.agent-eye {
  position: absolute;
  top: 25px;
  width: 18px;
  height: 26px;
  border-radius: 999px;
  background: #d9fff7;
  box-shadow: 0 0 14px rgba(217, 255, 247, 0.55);
  transition:
    height 180ms ease,
    top 180ms ease,
    transform 180ms ease,
    width 180ms ease;
}

.agent-eye-left {
  left: 43px;
}

.agent-eye-right {
  right: 43px;
}

.agent-mouth {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 6px;
  width: 54px;
  height: 34px;
  color: #c4fff3;
  transform: translateX(-50%);
  transition:
    bottom 180ms ease,
    transform 180ms ease;
}

.agent-mouth path {
  display: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.agent-core {
  position: absolute;
  bottom: 44px;
  width: 42px;
  height: 42px;
  border: 6px solid var(--status-accent);
  border-radius: 999px;
  background: #f7fbf8;
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.92),
    0 4px 10px rgba(32, 35, 31, 0.1);
}

.readout-panel {
  display: grid;
  gap: 20px;
}

.status-card {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 20px;
  align-items: center;
  min-height: 96px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(32, 35, 31, 0.16);
}

.status-mark {
  display: block;
  width: 70px;
  height: 70px;
  color: var(--status-accent);
}

.status-mark svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5.5;
}

.status-card h2 {
  margin: 0;
  color: var(--status-accent);
  font-size: 2.65rem;
  line-height: 1.02;
}

.status-card p {
  margin: 7px 0 0;
  color: #4f5d70;
  font-size: 1.28rem;
  line-height: 1.25;
}

.stats {
  display: grid;
}

.stat-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 48px;
  gap: 16px;
  align-items: center;
  min-height: 76px;
  border-bottom: 1px solid rgba(32, 35, 31, 0.13);
}

.stat-row:last-child {
  border-bottom: 0;
}

.stat-icon {
  display: grid;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--stat-color) 28%, white);
  border-radius: 12px;
  background: color-mix(in srgb, var(--stat-color) 14%, white);
  color: var(--stat-color);
  place-items: center;
}

.stat-icon svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.8;
}

.stat-content {
  display: grid;
  gap: 9px;
}

.stat-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #182230;
  font-size: 1.26rem;
  font-weight: 800;
}

.stat-value {
  color: #182230;
  font-size: 1.45rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.stat-track {
  display: block;
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e4e2;
}

.stat-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--stat-color);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--stat-color) 30%, transparent);
  transition: width 180ms ease;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 22px;
  margin: 26px auto 0;
  padding: 18px;
  border: 1px solid rgba(32, 35, 31, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.action-button,
.reset-button {
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease,
    transform 140ms ease;
}

.action-button {
  --action-color: #278a70;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  min-height: 96px;
  padding: 16px 20px;
  border: 1px solid color-mix(in srgb, var(--action-color) 42%, white);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--action-color) 11%, white), #ffffff 78%);
  color: var(--action-color);
  text-align: left;
  box-shadow: 0 10px 26px rgba(32, 35, 31, 0.07);
}

.action-button[data-action="feedContext"] {
  --action-color: #0fa28f;
}

.action-button[data-action="refocus"] {
  --action-color: #2376d5;
}

.action-button[data-action="restCycle"] {
  --action-color: #ee9b12;
}

.action-button[data-action="cleanMemory"] {
  --action-color: #7457c8;
}

.action-icon {
  display: grid;
  place-items: center;
}

.action-icon svg {
  width: 58px;
  height: 58px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
}

.action-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.action-title,
.action-subtitle,
.action-effects {
  display: block;
}

.action-title {
  color: #182230;
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1.12;
}

.action-subtitle {
  color: #536377;
  font-size: 1rem;
  line-height: 1.2;
}

.action-effects {
  color: color-mix(in srgb, var(--action-color) 68%, #536377);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.action-button:hover,
.action-button:focus-visible {
  border-color: var(--action-color);
  box-shadow:
    0 14px 30px rgba(32, 35, 31, 0.09),
    0 0 0 4px color-mix(in srgb, var(--action-color) 14%, transparent);
}

.action-button:active,
.reset-button:active {
  transform: translateY(1px);
}

.reset-button {
  display: grid;
  width: fit-content;
  grid-template-columns: 24px auto;
  gap: 10px;
  align-items: center;
  justify-content: center;
  min-width: 168px;
  min-height: 50px;
  margin: 16px auto 0;
  padding: 0 22px;
  border: 1px solid rgba(233, 91, 72, 0.28);
  background: rgba(255, 255, 255, 0.72);
  color: #e75e4c;
  font-size: 1.05rem;
  font-weight: 800;
}

.reset-icon,
.reset-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

.reset-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
}

.reset-button:hover,
.reset-button:focus-visible {
  border-color: #e75e4c;
  background: #fff7f5;
  box-shadow: 0 0 0 4px rgba(233, 91, 72, 0.1);
}

.game-shell[data-status="operational"] .agent-body {
  box-shadow:
    0 0 0 10px color-mix(in srgb, var(--status-accent) 14%, transparent),
    0 24px 38px rgba(32, 35, 31, 0.18),
    inset 0 -18px 26px rgba(32, 35, 31, 0.05);
}

.game-shell[data-status="stable"] .mouth-smile,
.game-shell[data-status="operational"] .mouth-smile,
.game-shell[data-status="low-context"] .mouth-tilt,
.game-shell[data-status="tired"] .mouth-flat,
.game-shell[data-status="noisy"] .mouth-noisy,
.game-shell[data-status="distracted"] .mouth-tilt,
.game-shell[data-status="degraded"] .mouth-frown {
  display: block;
}

.game-shell[data-status="low-context"] .agent {
  filter: saturate(0.9);
}

.game-shell[data-status="low-context"] .agent-eye {
  top: 29px;
  width: 16px;
  height: 24px;
}

.game-shell[data-status="tired"] .agent {
  transform: translateY(12px) scaleY(0.96);
}

.game-shell[data-status="tired"] .agent-eye {
  top: 34px;
  width: 18px;
  height: 5px;
  transform: none;
}

.game-shell[data-status="noisy"] .agent-body {
  box-shadow:
    0 0 0 7px color-mix(in srgb, var(--status-accent) 22%, transparent),
    0 0 0 15px rgba(217, 149, 35, 0.11),
    0 24px 38px rgba(32, 35, 31, 0.18);
}

.game-shell[data-status="noisy"] .agent-face {
  transform: rotate(-0.75deg);
}

.game-shell[data-status="noisy"] .agent-eye {
  top: 34px;
  width: 18px;
  height: 5px;
}

.game-shell[data-status="noisy"] .agent-eye-left {
  transform: rotate(8deg);
}

.game-shell[data-status="noisy"] .agent-eye-right {
  transform: rotate(-8deg);
}

.game-shell[data-status="distracted"] .agent {
  transform: rotate(-4deg);
}

.game-shell[data-status="distracted"] .agent-eye {
  top: 28px;
  width: 14px;
  height: 26px;
  transform: translateX(11px);
}

.game-shell[data-status="degraded"] .agent {
  filter: saturate(0.72);
  transform: translateY(18px) scaleY(0.9);
}

.game-shell[data-status="degraded"] .agent-body {
  box-shadow:
    0 0 0 8px color-mix(in srgb, var(--status-accent) 20%, transparent),
    0 16px 28px rgba(32, 35, 31, 0.14);
}

.game-shell[data-status="degraded"] .agent-eye {
  top: 31px;
  width: 20px;
  height: 5px;
  transform: rotate(45deg);
}

.game-shell[data-status="degraded"] .agent-eye-right {
  transform: rotate(-45deg);
}

@media (max-width: 860px) {
  .game-shell {
    padding: 18px;
    place-items: start center;
  }

  .game-panel {
    max-width: 720px;
    padding: 26px 24px 22px;
  }

  .game-header {
    grid-template-columns: 76px auto 76px;
  }

  .game-header h1 {
    font-size: 3rem;
  }

  .game-header p {
    max-width: 560px;
    margin-right: auto;
    margin-left: auto;
  }

  .game-divider {
    display: none;
  }

  .game-top {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .agent-stage {
    min-height: 360px;
  }

  .status-card {
    min-height: 116px;
    padding: 20px 24px;
    border: 1px solid rgba(43, 168, 157, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
  }

  .stats {
    padding: 0 24px;
    border: 1px solid rgba(32, 35, 31, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
  }

  .actions {
    padding: 0;
    border: 0;
    background: transparent;
  }

  .action-button {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 8px;
    min-height: 150px;
    text-align: center;
  }

  .action-effects {
    font-size: 0.74rem;
  }

  .reset-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .game-shell {
    display: block;
    padding: 12px;
  }

  .game-panel {
    width: auto;
    max-width: none;
    padding: 22px 14px 18px;
    border-radius: 0;
    box-shadow: none;
  }

  .game-header {
    grid-template-columns: 48px auto 48px;
    column-gap: 10px;
  }

  .game-header h1 {
    font-size: 2.45rem;
  }

  .game-header p {
    max-width: 300px;
    font-size: 1.02rem;
  }

  .circuit-line {
    transform: scale(0.76);
  }

  .circuit-line-right {
    transform: scaleX(-1) scale(0.76);
  }

  .agent-stage {
    min-height: 314px;
  }

  .agent {
    transform: scale(0.9);
  }

  .status-card {
    grid-template-columns: 62px 1fr;
    gap: 14px;
    padding: 16px;
  }

  .status-mark {
    width: 54px;
    height: 54px;
  }

  .status-card h2 {
    font-size: 2rem;
  }

  .status-card p {
    font-size: 1rem;
  }

  .stats {
    padding: 0 16px;
  }

  .stat-row {
    grid-template-columns: 44px minmax(0, 1fr) 40px;
    gap: 12px;
    min-height: 72px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
  }

  .stat-header {
    font-size: 1.08rem;
  }

  .stat-value {
    font-size: 1.24rem;
  }

  .actions {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
  }

  .action-button {
    min-height: 140px;
    padding: 14px 10px;
  }

  .action-icon svg {
    width: 50px;
    height: 50px;
  }

  .action-title {
    font-size: 1.12rem;
  }

  .action-subtitle {
    font-size: 0.88rem;
  }
}
