:root {
  color-scheme: dark;
  --ink: #13110f;
  --panel: #211d19;
  --panel-soft: #2b261f;
  --paper: #f7efe0;
  --muted: #cdbfa7;
  --amber: #f0b35f;
  --rose: #d77c75;
  --moss: #809b74;
  --line: rgba(247, 239, 224, 0.18);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(128, 155, 116, 0.28), transparent 34%),
    linear-gradient(225deg, rgba(215, 124, 117, 0.22), transparent 36%),
    var(--ink);
  color: var(--paper);
}

button,
textarea,
select,
input {
  font: inherit;
  max-width: 100%;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: center;
}

.oracle-stage,
.side-panel {
  border: 1px solid var(--line);
  background: rgba(33, 29, 25, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.oracle-stage {
  min-height: calc(100vh - 56px);
  padding: clamp(22px, 4vw, 52px);
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 22px;
}

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

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

.kicker {
  margin: 0 0 2px;
  color: var(--amber);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.3rem, 6vw, 5.8rem);
  font-weight: 500;
  line-height: 0.95;
  letter-spacing: 0;
}

.oracle-button {
  align-self: center;
  justify-self: center;
  width: min(360px, 52vw);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border: 1px solid rgba(240, 179, 95, 0.3);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 42%, rgba(240, 179, 95, 0.24), transparent 58%),
    linear-gradient(180deg, rgba(247, 239, 224, 0.06), rgba(0, 0, 0, 0.12));
  color: var(--paper);
  cursor: pointer;
  touch-action: none;
  user-select: none;
}

.oracle-button:focus-visible {
  outline: 3px solid rgba(240, 179, 95, 0.85);
  outline-offset: 5px;
}

.oracle-button.is-recording .button-dot {
  background: var(--rose);
  box-shadow: 0 0 0 14px rgba(215, 124, 117, 0.18), 0 0 36px rgba(215, 124, 117, 0.5);
}

.button-dot {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 12px rgba(240, 179, 95, 0.14), 0 18px 32px rgba(0, 0, 0, 0.32);
}

.button-title {
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 800;
}

.button-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.status {
  min-height: 24px;
  margin: 0;
  color: var(--muted);
}

.question-form {
  display: grid;
  gap: 12px;
}

textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(19, 17, 15, 0.68);
  color: var(--paper);
  outline: none;
}

textarea:focus,
select:focus,
input:focus {
  border-color: rgba(240, 179, 95, 0.68);
}

.control-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button,
.primary-button,
.secondary-button,
.secondary-inline {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--paper);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.icon-button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
}

.icon-button.listening {
  color: var(--ink);
  background: var(--rose);
}

.primary-button,
.secondary-button,
.secondary-inline {
  min-height: 48px;
  padding: 0 18px;
}

.primary-button {
  background: var(--amber);
  color: #1b1611;
  border-color: transparent;
  font-weight: 700;
}

.secondary-button {
  width: 100%;
  background: var(--panel-soft);
}

.secondary-inline {
  background: rgba(247, 239, 224, 0.06);
}

.answer-panel {
  min-height: 132px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.answer-panel p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3vw, 2.35rem);
  line-height: 1.25;
}

.side-panel {
  padding: 18px;
  display: grid;
  gap: 16px;
  align-self: stretch;
  align-content: start;
  min-width: 0;
  overflow: hidden auto;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.system-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(247, 239, 224, 0.05);
  min-width: 0;
}

.system-card p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.panel-label {
  margin-bottom: 6px !important;
  color: var(--amber);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

label {
  color: var(--muted);
  font-size: 0.86rem;
}

select {
  min-height: 42px;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--ink);
  color: var(--paper);
}

.side-panel textarea {
  min-height: 92px;
  padding: 12px;
  font-size: 0.9rem;
  line-height: 1.35;
}

input[type="range"] {
  accent-color: var(--amber);
}

.source-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.source-chip {
  border-left: 3px solid var(--moss);
  padding: 8px 10px;
  background: rgba(247, 239, 224, 0.06);
  color: var(--muted);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .oracle-stage {
    min-height: auto;
  }

  .oracle-button {
    width: min(280px, 70vw);
  }
}
