:root {
  --bg: #f4f1e8;
  --bg-strong: #e8e1d2;
  --surface: #fffdf7;
  --surface-2: #f7f3ea;
  --ink: #18211d;
  --muted: #69736c;
  --line: #d9d0bd;
  --forest: #173b2f;
  --forest-2: #255d49;
  --amber: #d98b2b;
  --amber-2: #f0b35f;
  --blue: #316f9f;
  --danger: #a33c2f;
  --ok: #2f7a55;
  --shadow: 0 18px 45px rgba(32, 37, 30, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
}

body {
  min-width: 320px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.is-hidden {
  display: none !important;
}

.home-page {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(23, 59, 47, 0.12), transparent 42%),
    linear-gradient(315deg, rgba(217, 139, 43, 0.12), transparent 48%),
    var(--bg);
}

.entry-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.entry-main {
  width: min(980px, 100%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 32px;
}

.brand-lockup.compact {
  margin-bottom: 24px;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--forest);
  color: #fff9e8;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.brand-mark.small {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
  box-shadow: none;
}

.overline {
  margin: 0 0 6px;
  color: var(--forest-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.entry-main h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  line-height: 1.02;
}

.entry-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.entry-tile {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.entry-tile:hover {
  transform: translateY(-3px);
  border-color: var(--forest-2);
}

.entry-tile strong {
  font-size: 1.7rem;
}

.entry-tile span:last-child {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.5;
}

.tile-icon,
.icon-btn svg,
.ghost-btn svg {
  width: 26px;
  height: 26px;
}

.tile-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--forest);
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-page {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-panel {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin: 0;
  font-size: 2.1rem;
}

.field,
.field-row {
  display: grid;
  gap: 7px;
}

.field {
  margin-bottom: 14px;
}

.field span,
.field-row span,
.section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--forest-2);
  box-shadow: 0 0 0 3px rgba(37, 93, 73, 0.14);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.primary-btn {
  background: var(--forest);
  color: #fff9e8;
}

.primary-btn:hover {
  background: var(--forest-2);
}

.primary-btn:disabled,
.ghost-btn:disabled,
.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.primary-btn:disabled {
  background: #7f8a82;
}

.ghost-btn,
.icon-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.ghost-btn:hover,
.icon-btn:hover {
  border-color: var(--forest-2);
}

.ghost-btn.small,
.icon-btn.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 0.78rem;
}

.icon-btn.wide {
  width: 100%;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.form-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.danger {
  color: var(--danger);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 18px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 42%),
    var(--forest);
  color: #fff9e8;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 900;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

.sidebar .section-label {
  color: rgba(255, 249, 232, 0.62);
}

.adventure-list {
  display: grid;
  gap: 8px;
}

.adventure-list button,
.published-list button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 12px;
}

.sidebar .adventure-list button {
  background: rgba(255, 249, 232, 0.1);
  border-color: rgba(255, 249, 232, 0.18);
  color: #fff9e8;
}

.sidebar .adventure-list button .list-meta {
  color: rgba(255, 249, 232, 0.68);
}

.adventure-list button.is-active,
.published-list button:hover {
  border-color: var(--forest-2);
  box-shadow: 0 0 0 3px rgba(37, 93, 73, 0.12);
}

.sidebar .adventure-list button.is-active {
  border-color: rgba(255, 249, 232, 0.65);
  background: rgba(255, 249, 232, 0.18);
  box-shadow: none;
}

.list-title {
  display: block;
  margin-bottom: 5px;
  font-weight: 900;
}

.list-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
  margin-top: auto;
}

.nav-item {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: rgba(255, 249, 232, 0.76);
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
}

.nav-item.is-active,
.nav-item:hover {
  background: rgba(255, 249, 232, 0.14);
  color: #fff9e8;
}

.builder-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 232, 0.88);
  backdrop-filter: blur(14px);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.15;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(360px, 440px);
  gap: 18px;
  padding: 18px;
}

.map-panel,
.inspector,
.player-panel,
.task-card,
.inventory-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-panel {
  min-height: 620px;
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  overflow: hidden;
}

.map-toolbar,
.inspector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.map-toolbar {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.map-canvas {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background:
    linear-gradient(rgba(23, 59, 47, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 59, 47, 0.12) 1px, transparent 1px),
    #dfe8db;
  background-size: 48px 48px;
}

.map-canvas.real-map {
  min-height: 520px;
  background: #dfe8db;
  isolation: isolate;
}

.map-canvas.real-map::before {
  display: none;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  font-size: 0.68rem;
}

.zone-map-label {
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--forest);
  font-weight: 900;
  text-shadow: 0 1px 0 #fff;
}

.start-marker {
  min-width: 48px;
  border-radius: 999px;
  background: var(--forest);
  color: #fff9e8;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
  box-shadow: 0 8px 18px rgba(23, 59, 47, 0.3);
}

.map-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 32% 38%, rgba(49, 111, 159, 0.18), transparent 20%),
    linear-gradient(120deg, transparent 42%, rgba(23, 59, 47, 0.14) 42%, rgba(23, 59, 47, 0.14) 45%, transparent 45%);
  pointer-events: none;
}

.start-pin,
.zone-dot {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.start-pin {
  left: 50%;
  top: 50%;
  min-width: 56px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--forest);
  color: #fff9e8;
  font-size: 0.74rem;
  font-weight: 900;
}

.zone-dot {
  display: grid;
  place-items: center;
  border: 2px solid rgba(23, 59, 47, 0.65);
  background: rgba(217, 139, 43, 0.22);
  color: var(--forest);
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 900;
  text-align: center;
  line-height: 1.1;
  padding: 8px;
}

.zone-dot.is-active {
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(217, 139, 43, 0.2);
}

.map-hint {
  margin: 0;
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.inspector {
  min-height: 620px;
  overflow: auto;
}

.save-state {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

#inspector-content {
  padding: 16px;
}

.panel-stack {
  display: grid;
  gap: 16px;
}

.panel-card {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-card:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.panel-card h2 {
  margin: 0;
  font-size: 1.05rem;
}

.split-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.compact-row button {
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.compact-row.is-active {
  border-color: var(--forest-2);
  background: #eef5eb;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #e6efe7;
  color: var(--forest);
  padding: 0 9px;
  font-size: 0.72rem;
  font-weight: 900;
}

.badge.amber {
  background: #fff2da;
  color: #92580f;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 50;
  transform: translateX(-50%) translateY(18px);
  max-width: min(460px, calc(100vw - 24px));
  border-radius: var(--radius-sm);
  background: var(--forest);
  color: #fff9e8;
  padding: 12px 14px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.player-page {
  background:
    linear-gradient(180deg, #173b2f 0 260px, var(--bg) 260px),
    var(--bg);
}

.player-shell {
  width: min(540px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.player-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff9e8;
}

.player-header .brand-mark {
  background: #fff9e8;
  color: var(--forest);
}

.player-header .ghost-btn {
  background: rgba(255, 249, 232, 0.12);
  color: #fff9e8;
  border-color: rgba(255, 249, 232, 0.35);
}

.player-panel,
.task-card,
.inventory-panel,
.player-map-panel,
.dialogue-stage {
  margin-top: 14px;
  padding: 18px;
}

.player-panel h1,
.task-card h1,
.finish-screen h1 {
  font-size: clamp(1.8rem, 8vw, 2.8rem);
  line-height: 1.05;
}

.published-list {
  display: grid;
  gap: 10px;
}

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

.status-pill {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: #e6efe7;
  color: var(--forest);
  font-size: 0.75rem;
  font-weight: 900;
  text-align: center;
}

.status-pill.amber {
  background: #fff2da;
  color: #8c520c;
}

.task-card {
  margin-top: 10px;
}

.zone-banner {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.task-card h2 {
  margin-bottom: 8px;
  font-size: 1.35rem;
}

.task-card p {
  color: var(--muted);
  line-height: 1.55;
}

.answer-area {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.player-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.player-map-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.player-map-panel h2 {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.player-map {
  width: 100%;
  height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #dfe8db;
}

.dialogue-stage {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dialogue-preview-shell {
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}

.dialogue-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  padding: 16px;
}

.dialogue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.dialogue-speaker {
  font-weight: 900;
}

.dialogue-kind {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dialogue-text {
  margin: 0;
  color: inherit;
  line-height: 1.55;
}

.dialogue-radio {
  background:
    linear-gradient(135deg, #1d2320, #0e1412),
    #141b18;
  color: #d7f8d9;
  border: 1px solid #2d3a34;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.dialogue-radio::before {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 14px;
  width: 74px;
  height: 28px;
  border-radius: 18px;
  background: repeating-linear-gradient(90deg, #27352f 0 4px, #111917 4px 8px);
  opacity: 0.55;
}

.dialogue-radio .dialogue-kind {
  background: #d7f8d9;
  color: #0e1412;
}

.dialogue-sms {
  background: #eef4f1;
  color: #15211c;
}

.dialogue-sms .dialogue-text {
  display: inline-block;
  max-width: 88%;
  border-radius: 18px 18px 18px 4px;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(20, 35, 28, 0.12);
}

.dialogue-sms .dialogue-kind {
  background: #dcebe5;
  color: var(--forest);
}

.dialogue-mission {
  background:
    linear-gradient(0deg, rgba(23, 59, 47, 0.08), rgba(23, 59, 47, 0.08)),
    #f6f1de;
  color: #1b211c;
  border: 1px solid #a99466;
}

.dialogue-mission::after {
  content: "TOP SECRET";
  position: absolute;
  right: 14px;
  bottom: 10px;
  color: rgba(163, 60, 47, 0.36);
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  transform: rotate(-9deg);
}

.dialogue-mission .dialogue-kind {
  background: var(--danger);
  color: #fff9e8;
}

.dialogue-letter {
  transform-origin: top center;
  animation: unfoldLetter 780ms cubic-bezier(.2,.8,.2,1) both;
  background:
    radial-gradient(circle at 20% 18%, rgba(139, 82, 34, 0.12), transparent 25%),
    linear-gradient(135deg, #f3dfb4, #fff1c9 45%, #e3c184);
  color: #442b17;
  border: 1px solid #b88a49;
  font-family: Georgia, "Times New Roman", serif;
}

.dialogue-letter::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 12px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #c7513b, #8f241b);
  transform: translateX(-50%);
  opacity: 0.18;
}

.dialogue-letter .dialogue-kind {
  background: #74401f;
  color: #fff1c9;
}

.dialogue-box {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.16), transparent 34%),
    linear-gradient(135deg, #744a22, #3f2816);
  color: #fff1c9;
  border: 1px solid #27170c;
}

.dialogue-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 38px;
  background: linear-gradient(90deg, transparent 0 46%, rgba(255, 217, 126, 0.4) 46% 54%, transparent 54%);
  border-bottom: 2px solid rgba(0,0,0,0.25);
}

.dialogue-box .dialogue-kind {
  background: #f0b35f;
  color: #3f2816;
}

.dialogue-anime {
  background:
    radial-gradient(circle at 88% 12%, rgba(49, 111, 159, 0.28), transparent 28%),
    linear-gradient(135deg, #fff, #eef7ff);
  color: #142236;
  border: 2px solid #18211d;
  box-shadow: 8px 8px 0 #18211d;
}

.dialogue-anime .dialogue-text {
  font-weight: 700;
}

.dialogue-anime .dialogue-kind {
  background: #316f9f;
  color: #fff;
}

.dialogue-cartoon {
  background: #fff;
  color: #121212;
  border: 3px solid #121212;
  box-shadow: 6px 6px 0 #f0b35f;
}

.dialogue-cartoon::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -18px;
  width: 32px;
  height: 32px;
  background: #fff;
  border-right: 3px solid #121212;
  border-bottom: 3px solid #121212;
  transform: rotate(45deg);
}

.dialogue-cartoon .dialogue-kind {
  background: #f0b35f;
  color: #121212;
}

@keyframes unfoldLetter {
  0% {
    opacity: 0;
    transform: perspective(700px) rotateX(-76deg) scaleY(0.55);
  }
  72% {
    opacity: 1;
    transform: perspective(700px) rotateX(6deg) scaleY(1.02);
  }
  100% {
    opacity: 1;
    transform: perspective(700px) rotateX(0) scaleY(1);
  }
}

.inventory-panel {
  display: grid;
  gap: 14px;
}

.inventory-panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inventory-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  padding: 8px 11px;
  font-size: 0.84rem;
  font-weight: 800;
}

.empty-state {
  color: var(--muted);
  font-size: 0.88rem;
}

.finish-screen {
  min-height: 360px;
  display: grid;
  align-content: center;
}

.tts-page {
  background:
    linear-gradient(180deg, #173b2f 0 220px, var(--bg) 220px),
    var(--bg);
}

.tts-shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.tts-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: #fff9e8;
}

.tts-header .brand-mark {
  background: #fff9e8;
  color: var(--forest);
}

.tts-header .ghost-btn {
  background: rgba(255, 249, 232, 0.12);
  color: #fff9e8;
  border-color: rgba(255, 249, 232, 0.35);
}

.tts-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  margin-top: 18px;
}

.tts-editor,
.tts-output {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 22px;
}

.tts-editor h1 {
  max-width: 680px;
  margin-bottom: 8px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1.04;
}

.tts-editor textarea {
  min-height: 220px;
  font-size: 1rem;
  line-height: 1.55;
}

.tts-counter {
  margin: -6px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-align: right;
}

.tts-output {
  display: grid;
  align-content: start;
  gap: 14px;
}

.tts-output h2 {
  margin: 0;
  font-size: 1.25rem;
}

.tts-status {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(135deg, rgba(49, 111, 159, 0.08), transparent),
    var(--surface-2);
  color: var(--forest);
  font-weight: 900;
  text-align: center;
}

.tts-output audio {
  width: 100%;
}

.tts-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.tts-presets button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.tts-presets button:hover {
  border-color: var(--forest-2);
}

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

  .sidebar {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 0;
  }

  .nav-item {
    text-align: center;
    padding: 0 8px;
  }

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

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

  .inspector {
    min-height: auto;
  }
}

@media (max-width: 700px) {
  .entry-shell {
    padding: 18px;
  }

  .entry-actions {
    grid-template-columns: 1fr;
  }

  .entry-tile {
    min-height: 190px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
  }

  .topbar {
    flex-direction: column;
  }

  .toolbar,
  .toolbar > * {
    width: 100%;
  }

  .workspace {
    padding: 10px;
  }

  .map-panel,
  .inspector {
    min-height: 520px;
  }

  .split-fields,
  .status-strip,
  .player-actions {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
