﻿:root {
  --bg: linear-gradient(180deg, #f3ead7 0%, #e7dbc2 52%, #ddd0b4 100%);
  --panel: rgba(255, 251, 245, 0.88);
  --panel-solid: #fffdf8;
  --text: #243127;
  --muted: #5f6d61;
  --accent: #a95f33;
  --accent-strong: #8f4921;
  --line: rgba(79, 94, 76, 0.14);
  --danger: #ba4138;
  --danger-strong: #8e2b24;
  --shadow: 0 22px 48px rgba(92, 78, 55, 0.14);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

button,
input,
textarea {
  font: inherit;
}

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

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

.shell {
  min-height: 100vh;
  padding: 24px;
}

.shell--chat {
  position: fixed;
  inset: 0;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 16px;
  align-content: stretch;
  padding: 24px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.brand__badge {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  font-size: 1.3rem;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(169, 95, 51, 0.26);
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.muted-text {
  color: var(--muted);
}

.ghost-link {
  color: var(--accent-strong);
  text-decoration: none;
  font-weight: 600;
}

.ghost-link-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}

.ghost-link--button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

.ghost-link--compact {
  font-size: 0.92rem;
  white-space: nowrap;
}

.hero-layout,
.chat-layout,
.home-layout {
  margin-top: 28px;
}

.chat-layout {
  margin-top: 18px;
  min-height: 0;
  height: 100%;
}

.shell--chat .chat-layout {
  margin-top: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.3fr 0.95fr;
  gap: 20px;
}

.hero-card,
.guide-card,
.chat-panel,
.notice-card,
.message-card,
.feature-card,
.recipe-card,
.history-card,
.note-card,
.overlay .dialog {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero-card,
.guide-card,
.chat-panel {
  border-radius: 28px;
  padding: 28px;
}

.home-layout {
  display: grid;
  gap: 20px;
}

.hero-card--recipe {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.9fr);
  gap: 24px;
  align-items: stretch;
}

.hero-card__copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-card h1,
.chat-panel h1 {
  margin: 10px 0 12px;
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.1;
}

.hero-card__text {
  line-height: 1.8;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.84rem;
  font-weight: 700;
}

.hero-card__chips,
.chat-panel__status,
.notice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(79, 94, 76, 0.1);
  color: var(--text);
  font-size: 0.92rem;
}

.status-badge--vip {
  background: rgba(169, 95, 51, 0.14);
  color: var(--accent-strong);
}

.status-badge__hint {
  margin-left: 8px;
  font-size: 0.72rem;
  color: rgba(95, 109, 97, 0.96);
  font-weight: 500;
}

.guide-list {
  margin: 18px 0 0;
  padding-left: 20px;
  line-height: 1.9;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2 {
  margin: 6px 0 0;
  font-size: clamp(1.5rem, 2.8vw, 2.2rem);
}

.feature-card {
  overflow: hidden;
  border-radius: 24px;
}

.feature-card--linked,
.recipe-card__link,
.history-card__link {
  color: inherit;
  text-decoration: none;
}

.recipe-card__link {
  display: block;
  height: 100%;
}

.feature-card--linked {
  display: block;
  height: 100%;
}

.feature-card img,
.recipe-card img {
  display: block;
  width: 100%;
  object-fit: cover;
}

.feature-card img {
  height: 280px;
}

.feature-card.feature-card--linked img {
  height: 280px;
}

.feature-card__body,
.recipe-card__body {
  padding: 18px 20px 20px;
}

.feature-card__body h2,
.recipe-card__body h2,
.recipe-card__body h3 {
  margin: 8px 0 10px;
}

.recipe-grid,
.note-list {
  display: grid;
  gap: 16px;
}

.recipe-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.recipe-card {
  overflow: hidden;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.recipe-card--compact img {
  height: 180px;
}

.recipe-card img {
  height: 220px;
}

.recipe-card__meta {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.recipe-card__topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.recipe-card__badge-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.recipe-card__date {
  color: var(--muted);
  font-size: 0.82rem;
}

.recipe-card__new {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ef7d4f 0%, #d94d2b 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: 0 8px 16px rgba(217, 77, 43, 0.22);
}

.recipe-card__new--history {
  width: fit-content;
}

.recipe-card__body p,
.note-card p {
  line-height: 1.7;
}

.recipe-card__footer {
  justify-content: flex-start;
  margin-top: auto;
  color: var(--accent-strong);
  font-weight: 700;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.history-card {
  overflow: hidden;
  border-radius: 22px;
}

.history-card__link {
  display: block;
  height: 100%;
}

.history-card img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
}

.history-card__body {
  display: grid;
  gap: 10px;
  padding: 18px 18px 20px;
}

.history-card__date {
  font-size: 0.82rem;
  color: var(--accent-strong);
  font-weight: 700;
}

.history-card__updated {
  font-size: 0.76rem;
  color: var(--muted);
}

.home-source-text {
  margin-top: 12px;
  font-size: 0.82rem;
}

.detail-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 24px;
  padding: 28px;
  border-radius: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.detail-hero__image img {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  border-radius: 24px;
}

.detail-hero__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-hero__summary {
  line-height: 1.8;
  color: var(--muted);
}

.detail-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 0;
}

.detail-metadata span {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(79, 94, 76, 0.1);
  color: var(--text);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

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

.detail-panel {
  border-radius: 24px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.ingredient-list,
.step-list {
  margin: 16px 0 0;
  padding-left: 20px;
  line-height: 1.8;
}

.note-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.note-card {
  border-radius: 20px;
  padding: 20px;
}

.note-card strong {
  display: block;
  margin-bottom: 10px;
}

.entry-fab {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 999px;
  background: rgba(116, 116, 116, 0.12);
  color: rgba(96, 96, 96, 0.82);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.88;
}

.overlay__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(28, 31, 26, 0.42);
}

.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
}

.overlay--secure {
  z-index: 30;
}

.overlay--secure .overlay__backdrop {
  background: rgba(246, 241, 233, 0.96);
  backdrop-filter: blur(12px);
}

.dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 380px);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(79, 94, 76, 0.18);
  background: rgba(255, 252, 247, 0.96);
  box-shadow: 0 28px 60px rgba(22, 26, 23, 0.22);
}

.hidden-entry-tip {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.6;
}

.dialog__form,
.field-shell,
.composer,
.composer__field {
  display: grid;
  gap: 14px;
}

.field-shell input,
.composer__field textarea,
.composer__field input {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  padding: 14px 16px;
  color: var(--text);
}

.composer__field textarea {
  resize: vertical;
  min-height: 120px;
}

.dialog__actions,
.composer__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.16s ease, opacity 0.16s ease;
}

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

.button:disabled,
.button--disabled {
  cursor: not-allowed;
  opacity: 0.62;
  transform: none;
  pointer-events: none;
}

.button--primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border: 1px solid var(--line);
}

.button--danger {
  background: linear-gradient(135deg, var(--danger) 0%, var(--danger-strong) 100%);
  color: #fff;
}

.button--file {
  display: inline-flex;
  justify-content: center;
}

.button--vip-tools[aria-expanded="true"] {
  border-color: rgba(169, 95, 51, 0.35);
  background: rgba(255, 247, 238, 0.94);
  color: var(--accent-strong);
}

.error-text,
.alert--error {
  color: var(--danger);
}

.chat-panel__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 8px;
}

.notice-grid {
  margin: 22px 0;
}

.notice-card {
  border-radius: 20px;
  padding: 18px;
  min-width: 220px;
}

.notice-card strong,
.notice-card span {
  display: block;
}

.notice-card strong {
  margin-bottom: 8px;
}

.alert {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
}

.message-list {
  display: grid;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  padding-bottom: 6px;
  margin-bottom: 0;
}

.message-empty {
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line);
  color: var(--muted);
}

.message-card {
  border-radius: 14px;
  padding: 7px 10px;
  border: 1px solid rgba(79, 94, 76, 0.08);
  box-shadow: 0 7px 16px rgba(92, 78, 55, 0.06);
}

.message-card--self {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(214, 194, 168, 0.36);
  box-shadow: 0 8px 18px rgba(169, 95, 51, 0.07);
}

.message-card--peer {
  background: rgba(235, 235, 235, 0.95);
  border-color: rgba(134, 142, 150, 0.18);
  box-shadow: 0 8px 18px rgba(80, 88, 95, 0.06);
}

.message-card--neutral {
  background: rgba(248, 243, 235, 0.9);
  border-color: rgba(199, 182, 159, 0.22);
}

.message-card__meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  flex-wrap: wrap;
}

.message-card__meta strong {
  font-size: 0.74rem;
}

.message-card__burn {
  display: inline-flex;
  margin-left: 8px;
  color: #b45f2c;
  font-weight: 700;
}

.vip-tools {
  position: absolute;
  right: 0;
  bottom: calc(100% - 4px);
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  width: min(460px, 100%);
  max-height: min(64vh, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(186, 148, 104, 0.24);
  border-radius: 20px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 22px 48px rgba(58, 46, 36, 0.18);
  backdrop-filter: blur(18px);
}

.vip-tools__header,
.vip-tool__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.vip-tools__header strong,
.vip-tools__header span {
  display: block;
}

.vip-tools__header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.vip-tools__close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  cursor: pointer;
}

.vip-tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.vip-tool-tile {
  display: grid;
  place-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  padding: 8px 6px;
  border: 1px solid rgba(186, 148, 104, 0.2);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  cursor: pointer;
}

.vip-tool-tile:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.vip-tool-tile.is-active {
  border-color: rgba(176, 91, 38, 0.42);
  background: rgba(255, 238, 218, 0.9);
}

.vip-tool-tile span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 12px;
  background: rgba(176, 91, 38, 0.1);
  color: #a64f1d;
  font-size: 0.78rem;
  font-weight: 800;
}

.vip-tool-tile strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
  font-size: 0.74rem;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.vip-tool-tile--danger span {
  background: rgba(186, 65, 56, 0.12);
  color: #9f332b;
}

.vip-tool-panel {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(186, 148, 104, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 8px 18px rgba(92, 78, 55, 0.06);
}

.vip-tool__head {
  font-size: 0.78rem;
}

.vip-tool__head strong {
  color: var(--ink);
}

.vip-tool__head span,
.vip-tool__head button {
  color: var(--muted);
  font-size: 0.7rem;
}

.vip-tools__close,
.vip-tool__head button,
.checklist-item button {
  border: 0;
  cursor: pointer;
}

.vip-tool__head button,
.checklist-item button {
  background: transparent;
}

.burn-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.burn-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1;
  padding: 7px 9px;
}

.burn-chip.is-active {
  border-color: rgba(176, 91, 38, 0.42);
  background: rgba(255, 238, 218, 0.9);
  color: #a64f1d;
  font-weight: 800;
}

.checklist-form,
.question-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.checklist-form input,
.question-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font: inherit;
  font-size: 0.78rem;
  padding: 8px 10px;
}

.checklist-items {
  display: grid;
  gap: 6px;
  max-height: 118px;
  overflow: auto;
  padding-right: 2px;
}

.checklist-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  padding: 7px 8px;
  font-size: 0.76rem;
}

.checklist-item label {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.checklist-item span {
  word-break: break-word;
}

.checklist-item.is-checked span {
  color: var(--muted);
  text-decoration: line-through;
}

.checklist-item button {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}

.question-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.question-answers {
  display: grid;
  gap: 5px;
  font-size: 0.76rem;
}

.question-answers p {
  margin: 0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  padding: 7px 8px;
}

.question-answers .is-mine {
  background: rgba(255, 238, 218, 0.78);
  color: #8e471b;
}

.vip-tool-panel--gomoku {
  gap: 10px;
}

.gomoku-board {
  display: grid;
  grid-template-columns: repeat(var(--gomoku-size), minmax(0, 1fr));
  width: min(100%, 330px);
  aspect-ratio: 1;
  border: 1px solid rgba(176, 91, 38, 0.22);
  border-radius: 10px;
  overflow: hidden;
  background: #f5d49b;
}

.gomoku-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.gomoku-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(126, 83, 38, 0.18);
}

.gomoku-legend__item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.gomoku-legend__item--mine::before {
  background: #1f2933;
}

.gomoku-legend__item--peer::before {
  background: #fffaf0;
  border: 1px solid rgba(86, 62, 39, 0.18);
}

.gomoku-cell {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  border: 0;
  border-right: 1px solid rgba(126, 83, 38, 0.2);
  border-bottom: 1px solid rgba(126, 83, 38, 0.2);
  background: transparent;
  cursor: pointer;
}

.gomoku-cell::before {
  content: attr(data-stone-label);
  position: absolute;
  inset: 18%;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.56rem;
  font-weight: 800;
  pointer-events: none;
  z-index: 2;
}

.gomoku-cell:disabled {
  cursor: default;
}

.gomoku-cell:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.32);
}

.gomoku-cell.is-mine::after,
.gomoku-cell.is-peer::after {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(54, 38, 22, 0.22);
}

.gomoku-cell.is-mine::after {
  background: #1f2933;
}

.gomoku-cell.is-mine::before {
  color: rgba(255, 255, 255, 0.95);
}

.gomoku-cell.is-peer::after {
  background: #fffaf0;
  border: 1px solid rgba(86, 62, 39, 0.18);
}

.gomoku-cell.is-peer::before {
  color: rgba(52, 42, 28, 0.92);
}

.gomoku-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.gomoku-actions__group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vip-tools__error {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.site-header--obscured,
.chat-layout--obscured {
  visibility: hidden;
  pointer-events: none;
}

.message-media {
  margin: 0;
  display: grid;
  gap: 3px;
}

.message-media__button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.message-media img {
  max-width: min(100%, 220px);
  border-radius: 10px;
  border: 1px solid var(--line);
}

.message-media figcaption {
  color: var(--muted);
  font-size: 0.68rem;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.image-viewer__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(20, 20, 20, 0.9);
}

.image-viewer__stage {
  position: relative;
  z-index: 1;
  width: min(100%, 1000px);
  height: min(100%, 88vh);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.image-viewer__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(24, 24, 24, 0.7);
  color: #fff;
  font-size: 1.1rem;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.image-viewer__close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.95);
  outline-offset: 2px;
}

.image-viewer__image {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  touch-action: none;
  user-select: none;
  -webkit-user-drag: none;
}

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

  .image-viewer__close {
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

.message-card p {
  margin: 0;
  line-height: 1.32;
  font-size: 0.93rem;
  word-break: break-word;
}

.burst-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}

.burst-card,
.burst-particle {
  position: fixed;
  pointer-events: none;
  will-change: transform, opacity;
}

.burst-card {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 10px 20px rgba(58, 46, 36, 0.12);
  opacity: 0;
}

.burst-card--self {
  background: rgba(255, 255, 255, 0.92);
}

.burst-card--peer {
  background: rgba(235, 235, 235, 0.94);
}

.burst-card--neutral {
  background: rgba(248, 243, 235, 0.92);
}

.burst-particle {
  border-radius: 999px;
  opacity: 0;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.35);
}

.burst-overlay.is-active .burst-card {
  animation: burst-card-exit 820ms cubic-bezier(0.18, 0.7, 0.2, 1) forwards;
}

.burst-overlay.is-active .burst-particle {
  animation: burst-particle-fly 880ms cubic-bezier(0.14, 0.72, 0.2, 1) forwards;
}

@keyframes burst-card-exit {
  0% {
    opacity: 0.96;
    transform: scale(1) rotate(0deg);
    filter: blur(0);
  }
  40% {
    opacity: 0.88;
    transform: scale(1.08) rotate(-1.5deg);
  }
  100% {
    opacity: 0;
    transform: scale(0.76) rotate(7deg);
    filter: blur(10px);
  }
}

@keyframes burst-particle-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(0.18) rotate(var(--burst-rotate));
  }
}

.composer__topline {
  display: grid;
  grid-template-columns: minmax(88px, 132px);
  gap: 8px;
}

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

.composer__label {
  font-size: 0.9rem;
  color: var(--muted);
}

.button--compact {
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.emoji-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 2px 0 4px;
}

.emoji-chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  min-width: 42px;
  height: 38px;
  cursor: pointer;
}

.chat-topbar {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.chat-topbar strong {
  font-size: 0.98rem;
}

.chat-topbar__state {
  color: var(--muted);
  font-size: 0.84rem;
}

.chat-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  align-self: stretch;
}

.chat-panel__status .status-badge {
  padding: 8px 11px;
  font-size: 0.84rem;
}

.composer {
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(79, 94, 76, 0.12);
  background: linear-gradient(180deg, rgba(255, 251, 245, 0) 0%, rgba(255, 251, 245, 0.92) 18%);
  flex: 0 0 auto;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

.upload-progress {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
}

.upload-progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.upload-progress__meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress__track {
  width: 100%;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(79, 94, 76, 0.12);
}

.upload-progress__bar {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #c97743 0%, #8f4921 100%);
}

.composer__field textarea,
.composer__field input {
  padding: 12px 14px;
}

.composer__field textarea {
  min-height: 92px;
}

.composer__footer--actions {
  align-items: center;
}

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

.button--send {
  min-width: 92px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .hero-layout {
    grid-template-columns: 1fr;
  }

  .hero-card--recipe,
  .recipe-grid,
  .history-grid,
  .note-list,
  .detail-grid,
  .detail-hero {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  body {
    overflow-x: hidden;
  }

  .shell {
    padding: 16px;
  }

  .shell--chat {
    position: fixed;
    inset: 0;
    padding: 12px;
    gap: 12px;
  }

  .chat-panel__header,
  .dialog__actions,
  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .site-header {
    display: block;
  }

  .hero-card,
  .guide-card,
  .chat-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .detail-hero,
  .detail-panel {
    padding: 18px;
  }

  .entry-fab {
    right: 9px;
    bottom: 9px;
    width: 40px;
    height: 40px;
    font-size: 0.96rem;
  }

  .composer__tools {
    width: 100%;
    justify-content: stretch;
  }

  .ghost-link-group {
    gap: 12px;
  }

  .message-media img {
    max-width: 100%;
  }

  .chat-layout {
    height: 100%;
  }

  .chat-panel {
    min-height: 0;
    height: 100%;
    gap: 8px;
  }

  .chat-panel__header {
    align-items: stretch;
    margin-bottom: 4px;
  }

  .chat-panel__status {
    gap: 8px;
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 2px;
  }

  .chat-panel__status .status-badge {
    white-space: normal;
    font-size: 0.75rem;
    line-height: 1.25;
    padding: 6px 9px;
    max-width: 100%;
  }

  .status-badge__hint {
    margin-left: 6px;
    font-size: 0.66rem;
  }

  .message-list {
    gap: 5px;
    padding-right: 2px;
  }

  .vip-tools {
    left: 0;
    right: 0;
    width: 100%;
    max-height: min(58vh, 440px);
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
  }

  .vip-tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .vip-tool-tile {
    min-height: 66px;
    padding: 7px 4px;
  }

  .vip-tool-tile span {
    width: 28px;
    height: 28px;
    border-radius: 10px;
  }

  .vip-tool-tile strong {
    font-size: 0.68rem;
  }

  .vip-tool-panel {
    padding: 10px;
    border-radius: 12px;
  }

  .checklist-items {
    max-height: 96px;
  }

  .message-card {
    padding: 6px 8px;
    border-radius: 12px;
  }

  .message-card__meta {
    gap: 6px;
    font-size: 0.68rem;
    margin-bottom: 3px;
  }

  .message-card__meta strong {
    font-size: 0.7rem;
  }

  .message-card p {
    font-size: 0.82rem;
    line-height: 1.28;
  }

  .message-media {
    gap: 3px;
  }

  .message-media img {
    max-width: min(180px, 100%);
    border-radius: 8px;
  }

  .history-card img,
  .detail-hero__image img {
    min-height: 220px;
    height: 220px;
  }

  .message-media figcaption {
    font-size: 0.64rem;
  }

  .composer {
    gap: 8px;
    padding-top: 8px;
  }

  .upload-progress {
    padding: 8px 10px;
  }

  .upload-progress__meta {
    font-size: 0.74rem;
  }

  .composer__topline {
    grid-template-columns: 88px;
    gap: 6px;
  }

  .button--compact,
  .button,
  .button--file {
    font-size: 0.78rem;
    padding: 8px 9px;
  }

  .composer__field textarea {
    min-height: 76px;
    padding: 10px 12px;
    font-size: 16px;
  }

  .composer__field input,
  .field-shell input,
  .checklist-form input,
  .question-form input,
  .dialog input {
    font-size: 16px;
  }

  .composer__footer {
    flex-direction: row;
    align-items: center;
  }

  .composer__footer--actions {
    gap: 8px;
    align-items: flex-start;
  }

  .composer__actions {
    gap: 6px;
    flex-wrap: wrap;
    overflow-x: visible;
    justify-content: flex-start;
    width: 100%;
  }

  .composer__actions > * {
    min-width: 0;
  }

  .composer__actions .button,
  .composer__actions .button--file {
    flex: 1 1 calc(25% - 6px);
    justify-content: center;
    text-align: center;
  }

  .button--send {
    min-width: 0;
    padding-inline: 16px;
    flex: 1 1 100%;
    min-height: 42px;
  }

  .emoji-strip {
    gap: 6px;
    overflow-x: visible;
    flex-wrap: wrap;
    padding-bottom: 2px;
  }

  .emoji-chip {
    min-width: 34px;
    height: 34px;
    flex: 0 1 auto;
  }

  .chat-header-row {
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .chat-topbar {
    min-width: 0;
    flex: 1 1 auto;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px;
  }

  .chat-topbar strong,
  .chat-topbar__state {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-topbar strong {
    font-size: 0.88rem;
  }

  .chat-topbar__state {
    font-size: 0.74rem;
    flex: 0 1 auto;
  }

  .ghost-link--compact {
    flex: 0 0 auto;
    font-size: 0.78rem;
    max-width: 82px;
  }
}
