:root {
  color-scheme: dark;
  --ink: #f8f5e7;
  --muted: #b6c4b8;
  --line: rgba(255, 255, 255, 0.16);
  --panel: rgba(13, 20, 18, 0.86);
  --panel-strong: rgba(6, 11, 10, 0.86);
  --grass: #61b05b;
  --gold: #e0bf4c;
  --redstone: #c94f3d;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07110f;
  color: var(--ink);
}

button {
  font: inherit;
}

.stage {
  width: 100vw;
  height: 100vh;
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 460px);
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 12%, rgba(224, 191, 76, 0.28), transparent 24%),
    linear-gradient(180deg, #183a4a 0%, #245b55 48%, #13211b 100%);
}

.scene-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

#einstein-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.einstein-speaking #einstein-canvas {
  filter: saturate(1.12) brightness(1.06);
}

.scene-panel::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 35vh;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.34));
}

.hud {
  position: relative;
  z-index: 2;
  min-width: 0;
  height: 100vh;
  padding: clamp(18px, 3vw, 32px);
  border-left: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(16px);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.22);
  overflow-y: auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.block-logo {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(90deg, transparent 48%, rgba(255, 255, 255, 0.2) 48% 52%, transparent 52%),
    linear-gradient(180deg, #75b85f 0 52%, #775334 52%);
  box-shadow: inset 0 -10px 0 rgba(0, 0, 0, 0.22);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.95;
  letter-spacing: 0;
}

.subtitle {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.phrase {
  margin-top: 18px;
  padding: 14px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  color: #fff9cf;
  font-size: clamp(18px, 2.4vw, 25px);
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.conversation {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.conversation p {
  margin: 0;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 11, 10, 0.48);
  color: var(--muted);
  line-height: 1.35;
}

.conversation strong {
  color: var(--ink);
}

.conversation span {
  overflow-wrap: anywhere;
}

#french-text {
  color: #fff9cf;
  font-weight: 850;
}

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

.controls button {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.11);
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.controls button:hover,
.controls button:focus-visible {
  border-color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.19);
  outline: none;
}

#listen-button {
  background: rgba(97, 176, 91, 0.3);
  border-color: rgba(159, 236, 150, 0.55);
}

#listen-button.listening {
  background: rgba(201, 79, 61, 0.34);
  border-color: rgba(255, 160, 140, 0.8);
  box-shadow: 0 0 22px rgba(201, 79, 61, 0.32);
}

.status-panel {
  position: absolute;
  left: clamp(14px, 3vw, 30px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(390px, calc(100% - 28px));
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(6, 11, 10, 0.72);
  color: var(--muted);
  backdrop-filter: blur(14px);
}

.einstein-speaking .status-panel {
  border-color: rgba(224, 191, 76, 0.62);
  box-shadow: 0 0 30px rgba(224, 191, 76, 0.22);
}

.status-light {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--redstone);
  box-shadow: 0 0 18px var(--redstone);
}

.status-panel.ready .status-light {
  background: var(--grass);
  box-shadow: 0 0 18px var(--grass);
}

.status-panel.listening .status-light,
.einstein-speaking .status-light {
  background: var(--redstone);
  box-shadow: 0 0 18px var(--redstone);
}

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

  .stage {
    height: auto;
    min-height: 100svh;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(440px, 58svh) auto;
  }

  .hud {
    height: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -20px 70px rgba(0, 0, 0, 0.2);
    overflow: visible;
  }

  .brand-row {
    align-items: flex-start;
  }

  .status-panel {
    left: 14px;
    right: 14px;
    max-width: none;
  }
}

@media (max-width: 520px) {
  .stage {
    grid-template-rows: minmax(360px, 52svh) auto;
  }

  .subtitle {
    display: none;
  }

  .phrase {
    min-height: 54px;
  }
}
