:root {
  --bg: #05111d;
  --bg-soft: #0c1d31;
  --text: #edf6ff;
  --text-soft: rgba(237, 246, 255, 0.72);
  --line: rgba(255, 255, 255, 0.1);
  --panel: rgba(7, 18, 30, 0.72);
  --panel-strong: rgba(6, 17, 28, 0.88);
  --glow: rgba(119, 227, 255, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 18%, rgba(43, 151, 255, 0.18), transparent 20%),
    radial-gradient(circle at 82% 24%, rgba(72, 224, 187, 0.16), transparent 18%),
    radial-gradient(circle at 50% 78%, rgba(255, 111, 145, 0.12), transparent 24%),
    linear-gradient(180deg, #07121d 0%, #030a12 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

.ambient {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.ambient-a {
  inset: 5% auto auto 8%;
  width: 26rem;
  height: 26rem;
  background: rgba(56, 132, 255, 0.24);
}

.ambient-b {
  inset: auto 10% 6% auto;
  width: 32rem;
  height: 32rem;
  background: rgba(60, 236, 167, 0.16);
}

.topbar,
.workspace {
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #8de7ff;
  font-size: 11px;
  letter-spacing: 0.34em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(2rem, 3.6vw, 4rem);
  line-height: 0.95;
  font-weight: 700;
}

.status-cluster {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.panel-card {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.status-pill {
  min-width: 150px;
  padding: 12px 14px;
  border-radius: 20px;
}

.status-pill span,
.metrics span,
.panel-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-pill strong,
.metrics strong {
  font-size: 15px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  min-height: calc(100vh - 140px);
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-height: 100%;
}

.gaze-button {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 240px;
  padding: 26px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  text-align: left;
  background: var(--panel-strong);
  cursor: default;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.gaze-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent 40%),
    radial-gradient(circle at 80% 22%, rgba(255, 255, 255, 0.18), transparent 22%);
  pointer-events: none;
}

.gaze-button.active {
  transform: translateY(-4px) scale(1.01);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12), 0 0 36px var(--glow);
}

.gaze-button.triggered {
  animation: pulse-out 540ms ease;
}

.button-index {
  position: relative;
  z-index: 1;
  font-size: 14px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  opacity: 0.86;
}

.button-name {
  position: relative;
  z-index: 1;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(1.8rem, 2.2vw, 3rem);
  line-height: 0.95;
  max-width: 12ch;
  font-weight: 700;
}

.button-progress {
  position: absolute;
  inset: auto 0 0 0;
  height: 8px;
  width: 0%;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
  transition: width 100ms linear;
}

.color-a { background: linear-gradient(145deg, rgba(57, 101, 255, 0.88), rgba(29, 45, 110, 0.92)); }
.color-b { background: linear-gradient(145deg, rgba(0, 165, 147, 0.9), rgba(8, 74, 80, 0.94)); }
.color-c { background: linear-gradient(145deg, rgba(249, 113, 72, 0.94), rgba(123, 43, 30, 0.94)); }
.color-d { background: linear-gradient(145deg, rgba(224, 69, 117, 0.92), rgba(109, 24, 65, 0.94)); }
.color-e { background: linear-gradient(145deg, rgba(153, 95, 255, 0.92), rgba(70, 29, 121, 0.96)); }
.color-f { background: linear-gradient(145deg, rgba(224, 181, 54, 0.92), rgba(110, 80, 20, 0.96)); }

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-card {
  padding: 20px;
  border-radius: 28px;
}

.panel-card h2 {
  margin: 0 0 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.panel-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.compact {
  padding: 18px;
}

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

.action-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.primary {
  background: #ecf6ff;
  color: #07111a;
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.metrics {
  display: grid;
  gap: 16px;
}

.eye-panel {
  overflow: hidden;
}

.eye-stage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.eye-shell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1.45 / 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.12), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.eye-shell::before {
  content: "";
  position: absolute;
  inset: 16% 10%;
  border-radius: 999px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.eye-ball {
  position: relative;
  width: 68%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 40%, rgba(255, 255, 255, 0.98), rgba(213, 232, 248, 0.9) 62%, rgba(166, 192, 218, 0.9) 100%);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.12);
}

.pupil {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 34%, rgba(94, 236, 255, 0.85), rgba(22, 55, 92, 0.9) 42%, rgba(8, 13, 23, 1) 68%);
  box-shadow: 0 0 20px rgba(103, 230, 255, 0.35);
  transform: translate(-50%, -50%);
  transition: transform 90ms linear;
}

.pupil::after {
  content: "";
  position: absolute;
  left: 28%;
  top: 24%;
  width: 18%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
}

.eye-caption {
  margin-top: 12px !important;
  font-size: 14px;
}

.calibration-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  background:
    radial-gradient(circle at center, rgba(7, 17, 31, 0.2), rgba(3, 9, 16, 0.92) 72%),
    linear-gradient(180deg, rgba(6, 15, 27, 0.8), rgba(6, 15, 27, 0.95));
}

.calibration-layer.hidden,
.gaze-cursor.hidden {
  display: none;
}

.calibration-copy {
  position: absolute;
  top: 28px;
  left: 28px;
  max-width: 560px;
}

.calibration-copy h2 {
  margin: 0 0 10px;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: clamp(2rem, 3vw, 3.2rem);
  font-weight: 700;
}

.calibration-copy p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.6;
}

.calibration-target {
  position: absolute;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border-radius: 50%;
  border: 0;
  background: #ecf6ff;
  box-shadow: 0 0 0 10px rgba(236, 246, 255, 0.12), 0 0 36px rgba(141, 231, 255, 0.55);
  cursor: pointer;
}

.calibration-target::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #0c1424;
}

.calibration-target.hidden {
  opacity: 0;
  pointer-events: none;
}

.gaze-cursor {
  position: fixed;
  z-index: 10;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 30px rgba(141, 231, 255, 0.55);
  pointer-events: none;
}

.gaze-cursor::before,
.gaze-cursor::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.75);
}

.gaze-cursor::before {
  left: 50%;
  top: -7px;
  bottom: -7px;
  width: 1px;
  transform: translateX(-50%);
}

.gaze-cursor::after {
  top: 50%;
  left: -7px;
  right: -7px;
  height: 1px;
  transform: translateY(-50%);
}

@keyframes pulse-out {
  0% { transform: scale(1); }
  35% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@media (max-width: 1100px) {
  body {
    overflow: auto;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .controls-grid {
    min-height: auto;
  }

  .gaze-button {
    min-height: 180px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    flex-direction: column;
  }

  .controls-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
}
