:root {
  color-scheme: light;
  --bg: #efe5d3;
  --bg-2: #d9c3a2;
  --panel: rgba(255, 249, 240, 0.86);
  --panel-strong: rgba(255, 255, 255, 0.72);
  --line: rgba(58, 37, 16, 0.12);
  --text: #25180b;
  --muted: rgba(37, 24, 11, 0.62);
  --accent: #af4212;
  --accent-2: #84310d;
  --danger: #8d1f1f;
  --radius: 28px;
  --shadow: 0 30px 80px rgba(94, 57, 17, 0.17);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Gill Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.72), transparent 24%),
    radial-gradient(circle at 85% 20%, rgba(175, 66, 18, 0.15), transparent 28%),
    linear-gradient(140deg, var(--bg), var(--bg-2));
}

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

.page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 28px 18px 40px;
}

.topbar {
  width: min(1080px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

.brand {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-style: italic;
  letter-spacing: 0.04em;
}

.switches {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel {
  width: min(1080px, 100%);
  min-height: 70vh;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
}

.tile {
  grid-column: span 4;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  min-width: 0;
}

.tile.wide {
  grid-column: span 8;
}

.tile-head,
.message-head,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tile-head {
  margin-bottom: 14px;
  font-weight: 700;
}

.project-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.project-tab {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.project-tab.active,
.project-tab:hover {
  background: rgba(175, 66, 18, 0.12);
  color: var(--text);
}

.route-tag,
.session-tag,
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.56);
}

.crumb {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 12px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(37, 24, 11, 0.14);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  outline: none;
}

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

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(175, 66, 18, 0.55);
  box-shadow: 0 0 0 4px rgba(175, 66, 18, 0.12);
}

button {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.switches button,
.ghost,
.primary {
  min-height: 44px;
  padding: 10px 16px;
}

.language-control {
  position: relative;
  display: flex;
  align-items: center;
}

.icon-button {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(37, 24, 11, 0.08);
  color: var(--text);
}

.icon-button img {
  width: 20px;
  height: 20px;
  display: block;
}

.language-control select {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  width: min(160px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  z-index: 20;
  padding: 10px 14px;
  border-radius: 16px;
  box-shadow: 0 18px 36px rgba(37, 24, 11, 0.16);
}

.switches button {
  background: rgba(37, 24, 11, 0.08);
  color: var(--text);
}

.switches button.active,
.primary {
  background: var(--accent);
  color: #fffaf6;
}

.ghost {
  background: rgba(37, 24, 11, 0.08);
  color: var(--text);
}

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

.ghost.small {
  min-height: 34px;
  padding: 6px 12px;
}

.board-grid,
.thread-list,
.message-list,
.chips {
  display: grid;
  gap: 12px;
}

.map-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.map-label-input {
  min-width: 160px;
  flex: 1 1 180px;
  max-width: 280px;
}

.map-label-input:disabled {
  opacity: 0.55;
}

.icon-tool {
  width: 44px;
  min-width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-tool img {
  width: 20px;
  height: 20px;
  display: block;
}

.icon-tool.active {
  background: var(--accent);
  color: #fffaf6;
}

.icon-tool.active img,
.icon-tool.danger img {
  filter: none;
}

.map-shell {
  margin-top: 14px;
}

.map-panel {
  min-height: 420px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.map-canvas {
  min-height: 420px;
}

.board-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.board-card,
.thread-card,
.message-card,
.empty-tile {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
}

.board-name,
.thread-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.board-meta,
.thread-meta,
.feedback {
  color: var(--muted);
}

.message-body {
  white-space: normal;
  line-height: 1.5;
}

.map-shell,
.map-panel {
  display: grid;
  gap: 12px;
}

.map-attachment {
  display: flex;
}

.map-attachment-preview {
  max-width: min(320px, 100%);
  max-height: 220px;
  border-radius: 18px;
  border: 1px solid var(--line);
  object-fit: cover;
  background: rgba(255, 255, 255, 0.72);
}

.scene3d-shell,
.scene3d-panel {
  display: grid;
  gap: 12px;
}

.map-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.scene3d-toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.map-toolbar .ghost.active {
  background: var(--accent);
  color: #fffaf6;
}

.scene3d-toolbar .ghost.active {
  background: var(--accent);
  color: #fffaf6;
}

.map-canvas {
  width: 100%;
  min-height: 420px;
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.scene3d-canvas {
  width: 100%;
  min-height: 460px;
  border-radius: 20px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.72);
}

.scene3d-canvas canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.feedback {
  margin-bottom: 16px;
}

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

@media (max-width: 860px) {
  .tile,
  .tile.wide {
    grid-column: span 12;
  }
}

@media (max-width: 640px) {
  .page {
    padding-inline: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel {
    padding: 18px;
  }
}
