:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --ink: #111111;
  --muted: #6f675f;
  --line: #ded8cc;
  --paper: #fffdf8;
  --paper-strong: #ffffff;
  --red: #c7362f;
  --gold: #c28a2c;
  --blue: #1f5a70;
  --green: #2f6b4f;
  --shadow: 0 18px 48px rgba(17, 17, 17, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #fffaf0 0%, var(--bg) 42%, #ebe7de 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  max-width: 560px;
  min-height: 100vh;
  margin: 0 auto;
  position: relative;
  padding: 18px 16px 92px;
}

.topbar,
.section-head,
.card-title-row,
.form-row,
.filter-row,
.toggle-row,
.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  padding: 6px 2px 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.12;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
}

.status-pill,
.anger-chip,
.locked {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--paper);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.screen {
  display: none;
}

.screen.is-active {
  display: block;
}

.hero-band {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 24px;
  border: 1px solid #151515;
  background:
    radial-gradient(circle at 84% 18%, rgba(199, 54, 47, 0.22), transparent 28%),
    linear-gradient(135deg, #171717 0%, #2d302d 52%, #8d6a2d 100%);
  color: #fff;
  box-shadow: var(--shadow);
}

.hero-band p {
  max-width: 320px;
  margin: 0;
  color: #efe8d8;
  line-height: 1.6;
}

.input-panel,
.reply-panel,
.settings-panel,
.privacy-note,
.prompt-panel,
.memory-card {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(17, 17, 17, 0.06);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea,
input[type="text"],
input[type="search"],
input:not([type]) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 12px;
  background: var(--paper-strong);
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

textarea:focus,
input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 90, 112, 0.12);
}

.primary-action,
.ghost-action,
.icon-action {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  width: 100%;
  margin-top: 12px;
  background: var(--red);
  color: #fff;
}

.ghost-action,
.icon-action {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-action.danger {
  color: var(--red);
  border-color: rgba(199, 54, 47, 0.4);
}

.form-row .primary-action {
  margin-top: 0;
}

.reply-line {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.48;
}

.reply-line strong {
  color: var(--red);
}

.empty-copy,
.privacy-note p,
.settings-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.filter-row {
  margin-top: 12px;
}

.filter-row input {
  flex: 1 1 auto;
}

.cards-list {
  margin-top: 12px;
}

.memory-card {
  position: relative;
}

.memory-card .event {
  margin-bottom: 9px;
  color: var(--muted);
}

.memory-card .diary {
  margin-bottom: 12px;
  line-height: 1.58;
}

.settings-panel input[type="range"] {
  width: 100%;
  accent-color: var(--red);
}

.switch {
  margin: 0;
  width: 52px;
  height: 30px;
  position: relative;
}

.switch input {
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c7c0b5;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  top: 3px;
  left: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(22px);
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(528px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.tab {
  min-width: 0;
  height: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.tab span,
.tab small {
  display: block;
}

.tab span {
  margin-bottom: 3px;
  font-size: 18px;
}

.tab small {
  font-size: 10px;
}

.tab.is-active {
  background: #151515;
  color: #fff;
}

@media (min-width: 720px) {
  .app-shell {
    padding-top: 28px;
  }

  .hero-band {
    min-height: 210px;
  }
}

.secondary-row {
  margin-top: 10px;
}

.secondary-row .ghost-action {
  flex: 1 1 0;
  padding-inline: 10px;
}

.compact {
  margin-top: 10px;
  padding: 12px;
}

.compact-head {
  align-items: flex-start;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.prompt-chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
  cursor: pointer;
}

.prompt-chip:active,
.arsenal-chip:active,
.ghost-action:active,
.primary-action:active,
.icon-action:active {
  transform: translateY(1px);
}

.arsenal-chip {
  display: inline-flex;
  align-items: center;
  margin: 0 8px 8px 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 420px) {
  .prompt-grid {
    grid-template-columns: 1fr;
  }
}
