@font-face {
  font-family: "Google Sans";
  src: url("/google-sans-medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #fff4ea;
  background: #130e0b;
  --muted: #c8b2a4;
  --accent: #ffad72;
  --line: #ffd1af2a;
  --field: #1b1410;
  --danger: #ffaaa0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 12% 0%, #4c2619a6, transparent 38rem),
    radial-gradient(ellipse at 100% 100%, #3d211579, transparent 35rem),
    #130e0b;
}

main { width: min(100%, 1120px); margin: auto; padding: 34px 26px; }
h1, h2, h3, p { margin: 0; }
h1 { letter-spacing: -.045em; line-height: 1.1; }
h2, h3 { font-size: 1.05rem; letter-spacing: -.018em; line-height: 1.25; }
.page-head, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  display: inline-flex; align-items: center; gap: 3px; width: fit-content;
  color: inherit; font-size: 1rem; font-weight: 750; letter-spacing: -.025em;
  line-height: 1; text-decoration: none; white-space: nowrap;
}
a.brand { min-height: 44px; }
.brand-icon { display: block; flex: none; }
.panel { padding: 17px 19px; border-radius: 20px; }

.glass {
  min-width: 0;
  border: 1px solid var(--line);
  background: linear-gradient(152deg, #49332a78, #221915d2 63%, #2b1c17b5);
  box-shadow: inset 0 1px #ffcfb612, 0 15px 40px #08050335;
  backdrop-filter: blur(14px);
}

.chat-page { min-height: 0; height: min(100dvh, var(--view-height, 100dvh)); overflow: hidden; }
.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  height: 100vh;
  height: min(100dvh, var(--view-height, 100dvh));
  max-width: 1320px;
  padding: max(17px, env(safe-area-inset-top)) max(22px, env(safe-area-inset-right))
    max(23px, env(safe-area-inset-bottom)) max(22px, env(safe-area-inset-left));
}

.chat-head { padding-inline: 5px; }
.chat-nav { display: flex; align-items: center; gap: 3px; }
.chat-nav :is(a, button) {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: none;
  text-decoration: none;
  font-size: .86rem;
  font-weight: 650;
}
.chat-nav [aria-current=page] { border-color: var(--line); color: var(--accent); background: #ffae7511; }
#open-chat[data-live=true]::after { width: 7px; height: 7px; margin-inline-start: 7px; border-radius: 50%; background: var(--accent); content: ""; }

.chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  overflow: hidden;
  border-radius: 24px;
  background:
    radial-gradient(ellipse at 50% 36%, #a047302e, transparent 65%),
    linear-gradient(150deg, #422b22ab, #211815f0 62%, #2d1d17c7);
}

.contact { position: relative; display: grid; place-items: center; min-height: 0; }
.center { display: grid; justify-items: center; gap: 12px; text-align: center; }
.center h1 { font-size: clamp(2rem, 5vw, 3.2rem); overflow-wrap: anywhere; }
.center p { margin-top: 6px; color: var(--muted); font-size: .83rem; }
.center p:empty { display: none; }
.orb {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: clamp(125px, 25vh, 208px);
  aspect-ratio: 1;
  flex: none;
}
.orb::before, .orb::after {
  position: absolute;
  inset: 5%;
  z-index: -1;
  content: "";
  border: 1px solid #ff9f6d34;
  border-radius: 50%;
}
.orb::after { inset: 14%; border-color: #ffad7152; box-shadow: 0 0 0 9px #ff89300e; }
.orb-core {
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 31% 23%, #ffe3bd 0%, #ffc382 12%, #f48848 30%, transparent 53%),
    radial-gradient(ellipse at 82% 81%, #ff944f 0%, #b44226 26%, transparent 62%),
    radial-gradient(ellipse at 36% 56%, #9f4d32 5%, #6b291f 48%, #341b16 80%);
  box-shadow: inset 0 0 0 1px #ffe1af66, inset -8px -9px 24px #2a0c0f6b, 0 0 38px #e765404d;
}
.orb[data-state=listening] .orb-core { box-shadow: inset 0 0 0 1px #ffe1afaa, 0 0 32px #ea763e80; }
.orb[data-state=speaking] .orb-core { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); box-shadow: 0 0 42px #ff824d9e; } }

.contact-actions { position: absolute; inset: 10px 11px auto auto; z-index: 1; display: flex; align-items: center; gap: 7px; }
.chat-menu { position: relative; }
.chat-menu summary {
  display: grid;
  place-items: center;
  width: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--field);
  font-size: 1.2rem;
}
.chat-menu summary::-webkit-details-marker { display: none; }
.chat-menu-items {
  position: absolute;
  inset: calc(100% + 6px) 0 auto auto;
  min-width: 152px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #2b1c15;
}
.chat-menu-items button { display: block; width: 100%; text-align: start; white-space: nowrap; }

.chat.has-thread { grid-template-rows: auto minmax(0, 1fr) auto auto; }
.chat.has-thread .contact {
  min-height: 62px;
  justify-items: start;
  padding: 8px 135px 8px 18px;
  border-bottom: 1px solid var(--line);
}
.chat.has-thread .center { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: start; }
.chat.has-thread .center h1 { font-size: 1.1rem; }
.chat.has-thread .center p { margin-top: 3px; font-size: .76rem; }
.chat.has-thread .orb { width: 46px; }

.messages { display: none; overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.chat.has-thread .messages { display: flex; flex-direction: column; gap: 10px; padding: 14px max(18px, calc((100% - 760px) / 2)); }
.message { font-size: .94rem; line-height: 1.5; }
.chat .message {
  flex: none;
  width: fit-content;
  max-width: min(84%, 590px);
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 4px 15px 15px;
  background: #130d0b75;
}
.chat .message.user { align-self: end; border-radius: 15px 4px 15px 15px; background: #cb682522; }
.scene-card {
  flex: none;
  padding: 13px 16px;
  border: 1px solid #ffb57b55;
  border-radius: 12px;
  background: #ffae7510;
  line-height: 1.5;
}
.scene-card .hint { margin-block: 3px 8px; }
.scene-card .message-text { font-size: .94rem; }
.scene-openers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.scene-openers button { font-size: .83rem; }
.center #relationship-status { color: var(--accent); }
.chat .message > strong { display: block; margin-bottom: 2px; font-size: .76rem; }
.message strong { color: var(--accent); }
.message-text { white-space: pre-wrap; }
.message button { margin-top: 3px; min-height: 44px; padding-inline: 6px; }
.turn-meta { display: block; margin-top: 3px; color: var(--muted); font-size: .74rem; }
.partial { width: min(100%, 784px); margin-inline: auto; padding: 1px 12px 7px; overflow-wrap: anywhere; }
.chat-footer { padding: 12px; border-top: 1px solid #ffe0c217; background: #130d0b45; }
.chat-footer > * { max-width: 760px; margin-inline: auto; }
.chat-actions { display: flex; align-items: end; justify-content: flex-end; gap: 8px; min-width: 0; }
.composer { display: flex; flex: 1; align-items: end; min-width: 0; gap: 8px; }
.composer textarea { min-height: 44px; max-height: 104px; resize: none; field-sizing: content; }
.call-button { min-height: 44px; white-space: nowrap; }
.call-button[data-active=true] { border-color: #fd8c7c99; color: #ffb4a5; background: #e6725921; }

button, input, select, textarea { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button {
  min-height: 44px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 10px;
  color: inherit; font-size: .87rem; font-weight: 650; cursor: pointer;
}
button:disabled { opacity: .48; cursor: default; }
:where(a, button, select, input, textarea, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { border-color: #ffc094; color: #291308; background: linear-gradient(105deg, #ffc393, #ff9c60 75%); }
.quiet { background: #ffcfad0e; }
.plain { border: 0; color: var(--accent); background: none; }
.danger { color: var(--danger); }
@media (hover: hover) {
  :is(.quiet, .chat-nav a, .chat-nav button):hover:not(:disabled) { border-color: #ffb57b66; background: #ffcfad19; }
  .primary:hover:not(:disabled) { filter: brightness(1.07); }
  .plain:hover:not(:disabled) { background: #ffcfad12; }
}

.field { display: grid; gap: 6px; min-width: 0; margin-top: 12px; }
label { color: var(--muted); font-size: .85rem; }
select, input:not([type=checkbox], [type=range]), textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; color: inherit; background: var(--field);
}
select { text-overflow: ellipsis; }
textarea { resize: vertical; line-height: 1.4; }
textarea::placeholder { color: #b4a092; }
.voice-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.preview { display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.preview-icon { width: 0; height: 0; border-block: 5px solid transparent; border-inline-start: 7px solid var(--accent); }
.preview[data-playing=true] .preview-icon { width: 8px; height: 8px; border: 0; background: var(--accent); }

.hint, .partial { color: var(--muted); font-size: .83rem; line-height: 1.5; }
.feedback { color: var(--accent); font-size: .84rem; line-height: 1.45; }
.chat-footer .feedback { margin-bottom: 8px; }
.feedback[data-error=true], .login [role=alert] { color: var(--danger); }
.hint:empty, .feedback:empty, .partial:empty { display: none; }

dialog {
  width: min(570px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; overflow: auto;
  border: 1px solid #ffbd9261; border-radius: 20px; color: inherit; background: #241912;
  box-shadow: 0 24px 80px #080302a3;
}
dialog::backdrop { background: #110a08a8; backdrop-filter: blur(5px); }
.settings-workspace { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: 24px; }
.workspace-head { display: flex; flex: none; align-items: center; gap: 10px; min-height: 61px; padding: 8px 22px; border-bottom: 1px solid var(--line); }
.dialog-head {
  justify-content: flex-start; padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
}
#close-chat-history, #close-scene-setup { margin-inline-start: auto; }
.panel-back { min-width: 42px; }
.dialog-body {
  flex: 1 1 auto; min-height: 0; padding: 14px 16px max(18px, env(safe-area-inset-bottom));
  overflow: auto; overscroll-behavior: contain;
}
.panel-feedback { padding: 10px 16px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.workspace-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.workspace-detail { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 18px 22px 24px; }
.workspace-detail > section { max-width: 620px; }
.workspace-detail > section > h3 { margin-bottom: 14px; }
.settings-categories { display: flex; gap: 5px; flex-wrap: wrap; margin: 0; padding: 10px 16px; list-style: none; }
.settings-categories button { border-color: transparent; color: var(--muted); background: none; }
.settings-categories [aria-current=true] { border-color: var(--line); color: var(--accent); background: #ffae7511; }
.settings-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.chat-history-list { margin-top: 12px; }
.chat-history-list button {
  display: grid; gap: 3px; width: 100%; min-height: 50px; background: #ffcfad0d; overflow-wrap: anywhere;
}
.chat-history-list [aria-current=true] { border-color: #ffb57b76; color: var(--accent); }
#chat-history[open], #scene-setup[open] { display: flex; flex-direction: column; overflow: hidden; }
.new-chat-actions, .scene-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scene-fields:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }
#scene-form > .scene-fields:first-child .field { margin-top: 0; }
#scene-mode-hint { margin-top: 7px; }
.scene-memory {
  margin-top: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: .84rem;
  overflow-wrap: anywhere;
}
.scene-memory ul { margin: 4px 0 0; padding-inline-start: 19px; }
.settings-list button { text-align: start; }
.settings-list .preset-choice { width: 100%; padding-inline: 12px; background: #ffcfad0d; }
.preset-list { margin-bottom: 14px; }
.preset-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.preset-choice { display: flex; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.preset-choice[aria-pressed=true] { border-color: #ffb57b66; color: var(--accent); }
.preset-choice[aria-pressed=true]::before {
  width: 5px; height: 9px; flex: none; content: "";
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.panel-submit { display: grid; gap: 6px; margin-top: 16px; }
.full-width { width: 100%; }
.panel-form > .field:first-child { margin-top: 0; }
.model-description {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px;
  font-size: .83rem; line-height: 1.45; overflow-wrap: anywhere;
}
.model-description:empty { display: none; }
.model-description ul { margin: 7px 0 0; padding-inline-start: 17px; color: var(--muted); }
.model-unavailable { margin-top: 7px; color: var(--danger); }
.model-status { margin: 4px 0 6px; }
.czech-review-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
#czech-review-status { margin-top: 12px; }
.czech-review-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 10px 0; }
.czech-review-comparison section { padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.czech-review-comparison h4 { margin: 0 0 8px; font-size: .85rem; color: var(--muted); }
.czech-review-comparison p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.czech-review-comparison del { background: #e7897b28; text-decoration-color: var(--danger); }
.czech-review-comparison ins { background: #91c9982a; text-decoration-color: #91c998; }
@media (max-width: 520px) {
  .czech-review-comparison { grid-template-columns: minmax(0, 1fr); }
}
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
summary { min-height: 44px; padding-block: 10px; cursor: pointer; }
.cost-heading { margin-top: 18px; }
#settings-history a { margin-top: 8px; }
#cost-total { color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
#cost-parts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; color: var(--muted); font-size: .84rem; }
#cost-parts dd { margin: 0; text-align: end; }
#cost-history { color: var(--muted); font-size: .85rem; }
#cost-list { margin: 0; padding-inline-start: 18px; }
#history-detail { padding: 18px; }
.access-page {
  width: min(100%, 500px);
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  align-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
}
.login {
  display: grid;
  gap: 19px;
  padding: clamp(22px, 6vw, 34px);
}
.login h1 { font-size: 1.85rem; }
.login form { display: grid; gap: 9px; }
.login label { font-size: .9rem; font-weight: 600; }
.login input { min-height: 46px; }
.login input + label { margin-top: 4px; }
.login form .primary { margin-top: 6px; }
.login .hint, .access-message { line-height: 1.5; overflow-wrap: anywhere; }
.access-message { padding: 10px 12px; border-radius: 10px; background: #ffcfad0e; }
.access-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .875rem; }
.access-divider::before, .access-divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.access-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.access-links a { display: inline-flex; align-items: center; min-height: 36px; color: var(--accent); text-underline-offset: 3px; }
.access-document { width: min(100%, 760px); }
.access-content { display: grid; gap: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.access-content h2 { margin-top: 8px; font-size: 1.1rem; }
.access-content a { color: var(--accent); text-underline-offset: 3px; }
.login .google-login {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 18px;
  align-items: center;
  column-gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid #747775;
  border-radius: 999px;
  background: #fff;
  color: #1f1f1f;
  font: 500 .875rem/1.25rem "Google Sans", Arial, sans-serif;
  text-align: center;
  box-shadow: 0 2px 8px #10090655;
}
.login .google-login:hover { background: #f8faff; }
.login .google-login:active { background: #edf3fd; }
.login .google-login:focus-visible { outline-color: #adccff; }
.google-login img { object-fit: contain; }
.roles-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; }
.roles-list li {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  padding: 10px 14px;
}
.roles-list li + li { border-top: 1px solid var(--line); }
.roles-email { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.roles-admin { color: var(--muted); font-weight: 600; padding: 10px 0; }
.roles-list form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.roles-list select, .roles-list button { min-height: 44px; }
.roles-list select { width: 6rem; }
.roles-pages { align-items: center; }
#signed-in-account { margin-block: 10px 16px; overflow-wrap: anywhere; }
.login-buy { margin-top: 16px; text-align: center; }
.login-buy a, .payment-card a { color: var(--accent); text-underline-offset: 3px; }

.payment-layout { width: min(100%, 560px); display: grid; gap: 16px; padding: clamp(18px, 5vw, 42px); }
.payment-layout-wide { width: min(100%, 1120px); }
.payment-card { display: grid; gap: 18px; padding: clamp(18px, 5vw, 28px); }
.payment-card h1 { font-size: clamp(1.55rem, 5vw, 2.15rem); }
.payment-note { color: var(--accent); font-size: .85rem; }
.payment-summary { display: grid; gap: 8px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; line-height: 1.45; }
.payment-summary strong { font-size: 1.45rem; }
.payment-form { display: grid; gap: 8px; }
.payment-form button { margin-top: 4px; }
.payment-form [role=alert] { color: var(--danger); }
.payment-links { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .85rem; }
.payment-links:empty { display: none; }
.payment-card code { overflow-wrap: anywhere; }
.payment-legal { display: grid; gap: 16px; line-height: 1.6; overflow-wrap: anywhere; }
.payment-legal section { display: grid; gap: 8px; }
.payment-legal h2 { font-size: 1.12rem; }
.payment-legal pre { white-space: pre-wrap; margin: 0; font: inherit; }
.payment-table { overflow-x: auto; }
.payment-table table { width: 100%; border-collapse: collapse; text-align: left; font-size: .86rem; }
.payment-table th, .payment-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.payment-table th { color: var(--muted); }

@media (min-width: 1024px) and (orientation: landscape) {
  .shell { grid-template: minmax(0, 1fr) / clamp(152px, 14vw, 184px) minmax(0, 1fr); }
  .chat-head {
    align-items: stretch; justify-content: flex-start; flex-direction: column; gap: 15px;
    padding: 15px 11px; border: 1px solid var(--line); border-radius: 20px; background: #281b16b8;
  }
  .chat-head .brand { margin-inline: 2px; }
  .chat-nav { display: grid; align-content: start; gap: 6px; }
  .chat-nav button { justify-content: flex-start; }
  .settings-workspace[data-area=settings] .workspace-body { display: grid; grid-template-columns: 145px minmax(0, 1fr); }
  .settings-categories { flex-direction: column; padding: 13px 10px; }
  .settings-categories button { display: block; width: 100%; text-align: start; }
  #settings-index { border-inline-end: 1px solid var(--line); }
}

@media (max-width: 620px) {
  main { padding: 17px 13px; }
  .shell {
    gap: 8px; padding: max(7px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .chat-head { flex-wrap: wrap; gap: 5px; padding-inline: 2px; }
  .chat-nav { gap: 0; }
  .chat-nav :is(a, button) { padding-inline: 7px; font-size: .8rem; }
  .brand { font-size: .9375rem; }
  .brand-icon { width: 26px; height: 26px; }
  .chat { border-radius: 16px; }
  .chat-footer { padding: 8px; }
  .chat-actions { flex-wrap: wrap; }
  .composer { flex: 1 1 100%; }
  .call-button:not([data-active=true]) { margin-inline-start: auto; }
  .settings-workspace { border-radius: 16px; }
  .workspace-head { padding-inline: 11px; }
  .workspace-detail { padding: 12px 11px 18px; }
  .settings-categories { padding-inline: 8px; gap: 3px; }
  .chat.has-thread .messages { padding: 9px 10px; }
  .chat .message { max-width: 89%; }
  select, input:not([type=checkbox], [type=range]), textarea { font-size: 16px; }
}

@media (max-height: 420px) {
  .chat:not(.has-thread) .orb { width: clamp(62px, 25dvh, 95px); }
  .chat:not(.has-thread) .center { gap: 3px; }
  .chat:not(.has-thread) .center h1 { font-size: 1.35rem; }
}

@media (prefers-reduced-motion: reduce) {
  .orb-core { animation: none !important; }
}
