:root {
  color-scheme: dark;
  --bg: #0d1012;
  --panel: #15191b;
  --panel-2: #1c2225;
  --ink: #f5f0df;
  --muted: #aeb8b4;
  --line: #354044;
  --brass: #d0a24d;
  --teal: #38a59d;
  --shadow: 0 20px 80px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: linear-gradient(150deg, #0d1012 0%, #161d20 48%, #112624 100%);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

.shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.stage {
  width: min(980px, 100%);
  min-height: min(820px, calc(100dvh - 56px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  overflow: hidden;
  border: 1px solid rgba(245, 240, 223, 0.16);
  border-radius: 8px;
  background: rgba(16, 16, 14, 0.88);
  box-shadow: var(--shadow);
}

.hud {
  min-height: 112px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  padding: 32px 28px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(56, 165, 157, 0.16), rgba(208, 162, 77, 0.1));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brass);
  font-size: 0.78rem;
  line-height: 1.2;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.25;
  font-weight: 760;
}

.meters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.results-link {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  color: var(--brass);
  font-size: 0.82rem;
  line-height: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.meters span,
.controls button {
  min-height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(245, 240, 223, 0.18);
  border-radius: 8px;
  background: rgba(24, 24, 20, 0.84);
  color: var(--ink);
  padding: 0 12px;
  font-size: 0.82rem;
  line-height: 1;
}

.oracle {
  display: grid;
  grid-template-columns: minmax(220px, 384px) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  min-height: 420px;
  padding: 32px;
  background: var(--bg);
}

.sigil-canvas {
  width: min(384px, 100%);
  height: auto;
  aspect-ratio: 1;
  border: 1px solid rgba(245, 240, 223, 0.24);
  border-radius: 8px;
  background: #efe8d2;
  image-rendering: pixelated;
}

#oracleText {
  width: min(680px, 100%);
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-size: 1.58rem;
  line-height: 1.38;
  overflow-wrap: anywhere;
  text-align: left;
}

.command {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 18px 20px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

#promptInput {
  min-width: 0;
  height: 52px;
  border: 1px solid rgba(245, 240, 223, 0.18);
  border-radius: 8px;
  background: #0f100d;
  color: var(--ink);
  padding: 0 16px;
  outline: none;
}

#promptInput:focus {
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(196, 155, 79, 0.16);
}

#promptInput::placeholder {
  color: #8f8978;
}

#sampleButton {
  width: 96px;
  height: 52px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brass), #e2c275);
  color: #15110a;
  font-weight: 750;
  cursor: pointer;
}

#sampleButton:disabled,
#promptInput:disabled {
  cursor: wait;
  opacity: 0.62;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 0 20px 18px;
  background: var(--panel);
}

.controls label {
  min-width: 0;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.controls input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.controls button {
  height: 40px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .shell {
    padding: 0;
  }

  .stage {
    min-height: 100dvh;
    border-width: 0;
    border-radius: 0;
  }

  .hud {
    min-height: 132px;
    display: grid;
    align-items: end;
    padding: 24px 18px 18px;
  }

  .meters {
    justify-content: flex-start;
  }

  h1 {
    font-size: 1.62rem;
  }

  .oracle {
    grid-template-columns: 1fr;
    min-height: 260px;
    padding: 24px 18px;
    justify-items: center;
  }

  .sigil-canvas {
    width: 152px;
    height: 152px;
  }

  #oracleText {
    font-size: 1.28rem;
    text-align: center;
  }

  .command {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  #sampleButton {
    width: 100%;
  }

  .controls {
    grid-template-columns: 1fr;
    padding: 0 14px 14px;
  }
}
