:root {
  --bg: #f7f4ef;
  --surface: #ffffff;
  --ink: #202225;
  --muted: #676f7d;
  --line: #d9d6cf;
  --accent: #176b87;
  --accent-2: #a43e3e;
  --soft: #e7f0f1;
  --shadow: 0 18px 45px rgba(34, 32, 26, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.58;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 52px);
  border-bottom: 1px solid rgba(32, 34, 37, 0.12);
  background: rgba(247, 244, 239, 0.92);
  backdrop-filter: blur(14px);
}
.brand { font-weight: 750; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.nav a, .link-button {
  color: var(--ink);
  font-size: 14px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.nav a:hover, .link-button:hover { color: var(--accent); }
.lang-switch {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
}
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 34px 0 64px; }
.hero {
  min-height: 380px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
  padding: clamp(28px, 5vw, 62px) 0;
}
.eyebrow { color: var(--accent-2); font-weight: 720; text-transform: uppercase; font-size: 12px; letter-spacing: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: 0; margin: 0 0 14px; }
h1 { font-size: clamp(42px, 8vw, 82px); }
h2 { font-size: clamp(24px, 4vw, 38px); }
h3 { font-size: 18px; }
.lead { font-size: clamp(17px, 2.3vw, 22px); color: #3c4148; max-width: 760px; }
.portrait {
  min-height: 300px;
  border-left: 4px solid var(--accent);
  padding: 26px;
  background: linear-gradient(135deg, #ffffff, #e8f0ec);
  box-shadow: var(--shadow);
}
.meta-list { display: grid; gap: 10px; margin-top: 24px; }
.meta-list span { color: var(--muted); display: block; font-size: 13px; }
.section { padding: 34px 0; border-top: 1px solid var(--line); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card {
  background: var(--surface);
  border: 1px solid rgba(32, 34, 37, 0.1);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(34, 32, 26, 0.05);
}
.card p { color: var(--muted); margin: 8px 0 0; }
.zone-badge {
  display: inline-flex;
  margin: 2px 0 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}
.list { padding-left: 18px; margin: 12px 0 0; }
.list li { margin: 8px 0; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 720;
  cursor: pointer;
}
.button.secondary { background: transparent; color: var(--accent); }
.button.danger { border-color: var(--accent-2); background: var(--accent-2); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 700; }
input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
}
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  font: inherit;
}
textarea { min-height: 130px; resize: vertical; }
.split { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.sidebar { position: sticky; top: 76px; display: grid; gap: 10px; }
.session-row {
  display: grid;
  grid-template-columns: 1fr 34px;
  gap: 8px;
  align-items: stretch;
}
.session-row form { margin: 0; }
.session-link { display: block; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.session-link small { display: block; color: var(--muted); margin-top: 4px; }
.session-delete {
  width: 34px;
  height: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.session-delete:hover,
.session-delete:focus {
  color: #fff;
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.chatbox { display: grid; gap: 14px; }
.message { padding: 16px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }
.message.user { border-left: 4px solid var(--accent); }
.message.assistant { border-left: 4px solid #3b7f52; }
.message.system { border-left: 4px solid #9b8c39; color: var(--muted); }
.message pre, .record pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  margin: 0;
}
.notice { border: 1px solid #d7b35c; background: #fff8e4; color: #66511c; padding: 12px 14px; border-radius: 8px; }
.muted { color: var(--muted); }
.journal-group { margin-top: 28px; }
.journal-list { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.journal-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0 20px;
  border-bottom: 1px solid var(--line);
}
.journal-toolbar h1 { margin: 0; font-size: clamp(30px, 5vw, 54px); }
.journal-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(420px, 100%);
}
.journal-filter label { color: var(--muted); font-weight: 750; font-size: 13px; }
.journal-card p { display: none; }
.footer { color: var(--muted); border-top: 1px solid var(--line); padding: 24px clamp(18px, 4vw, 52px); }
.feed-masonry {
  columns: 3 280px;
  column-gap: 18px;
}
.feed-item {
  position: relative;
  break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin: 0 0 18px;
  padding: 18px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 28px rgba(34, 32, 26, 0.05);
}
.feed-controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.feed-controls form { margin: 0; }
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 0;
  padding: 0 0 1px;
  cursor: pointer;
}
.icon-action.favorite:hover,
.icon-action.favorite:focus {
  color: #fff;
  background: #c34a73;
  border-color: #c34a73;
}
.icon-action.delete:hover,
.icon-action.delete:focus {
  color: #fff;
  background: var(--accent-2);
  border-color: var(--accent-2);
}
.heart-mark { color: #c34a73; }
.feed-item h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-top: 8px;
}
.feed-item p {
  color: var(--muted);
  font-size: 14px;
}
.feed-item time {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
}
.review-shell { max-width: 860px; }
.review-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-top: 24px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: clamp(22px, 5vw, 44px);
  box-shadow: var(--shadow);
  touch-action: pan-y;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  will-change: transform;
}
.review-card.is-dragging {
  transition: none;
  cursor: grabbing;
}
.review-card.swipe-right {
  border-color: #c34a73;
  box-shadow: 0 18px 42px rgba(195, 74, 115, 0.18);
}
.review-card.swipe-left {
  border-color: var(--accent-2);
  box-shadow: 0 18px 42px rgba(164, 62, 62, 0.18);
}
.review-card > :not(.swipe-cue) {
  position: relative;
  z-index: 1;
}
.swipe-cue {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  padding: 0 28px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.favorite-cue {
  justify-content: flex-start;
  background: #c34a73;
}
.delete-cue {
  justify-content: flex-end;
  background: var(--accent-2);
}
.review-card.swipe-right .favorite-cue,
.review-card.swipe-left .delete-cue {
  opacity: 1;
}
.review-card h2 {
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.18;
  margin: 18px 0 28px;
}
.review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.review-actions form { margin: 0; }
.review-actions .button { width: 100%; }
.favorite-wide {
  background: #c34a73;
  border-color: #c34a73;
}

@media (max-width: 820px) {
  .hero, .split { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .journal-toolbar { align-items: stretch; flex-direction: column; }
  .journal-filter { width: 100%; }
  h1 { font-size: 44px; }
  .review-actions { grid-template-columns: 1fr; }
}
