:root {
  --ink: #090909;
  --muted: #6f2a2d;
  --line: #f0c7ca;
  --white: #ffffff;
  --soft: #fff6f6;
  --red: #e1161f;
  --deep-red: #b90f17;
  --pale-red: #ffe7e8;
  --shadow: 0 18px 46px rgba(185, 15, 23, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--white);
  font-family: "Segoe UI", system-ui, sans-serif;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  gap: 22px;
  margin-bottom: 18px;
  text-align: center;
}

.eyebrow,
.panel-heading span,
label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
}

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

h1 {
  max-width: 760px;
  margin-bottom: 10px;
  font-size: clamp(2.35rem, 7vw, 6rem);
  line-height: 0.92;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 4px;
  font-size: 1.08rem;
}

.subtitle {
  max-width: 620px;
  margin-bottom: 10px;
  color: #3b1a1c;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.4;
}

.hero-line {
  max-width: 660px;
  margin: 0 auto 8px;
  color: var(--ink);
  font-size: clamp(1.15rem, 2.2vw, 1.55rem);
  font-weight: 900;
  line-height: 1.25;
}

.guide-line {
  max-width: 620px;
  margin: 0 auto 18px;
  color: var(--red);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  font-weight: 800;
  line-height: 1.35;
}

.book-note {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-bottom: 0;
  padding-left: 0;
  position: relative;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.book-note::before {
  content: "";
  position: static;
  width: 70px;
  height: 10px;
  background: var(--red);
}

.book-note span {
  color: #3b1a1c;
  font-size: 0.92rem;
  font-weight: 700;
  text-transform: none;
}

.guide-button {
  display: block;
  min-height: 42px;
  margin: 0 auto 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 18px;
  color: var(--red);
  background: var(--white);
  font-weight: 900;
}

.guide-button:hover {
  background: var(--soft);
}

.cover-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.cover-card {
  overflow: visible;
  margin: 0;
  width: min(240px, 70vw);
  aspect-ratio: 6 / 9;
  justify-self: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  position: relative;
}

.cover-card::after {
  content: "";
  position: absolute;
  top: 8px;
  right: -9px;
  bottom: 8px;
  width: 10px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(90deg, #d8d8d8 0%, #f7f7f7 45%, #c9c9c9 100%);
  box-shadow: 8px 12px 24px rgba(0, 0, 0, 0.12);
  z-index: 0;
}

.cover-card img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
  box-shadow:
    18px 24px 38px rgba(0, 0, 0, 0.2),
    0 2px 0 rgba(255, 255, 255, 0.7) inset,
    2px 0 0 rgba(0, 0, 0, 0.1);
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.mode-tab {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
}

.mode-tab.is-active {
  border-color: var(--red);
  color: white;
  background: var(--red);
}

.panel {
  padding: 18px;
  border-top: 6px solid var(--red);
}

.lab-panel {
  margin-bottom: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.book-principle {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 8px;
  background: var(--pale-red);
}

.book-principle strong {
  display: block;
  margin-bottom: 5px;
}

.book-principle p,
.privacy-copy {
  margin-bottom: 0;
  color: #3b1a1c;
  line-height: 1.45;
}

.shift-form {
  display: grid;
  gap: 10px;
}

.deep-fields {
  display: grid;
  gap: 10px;
}

[hidden] {
  display: none !important;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.choice-button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: var(--soft);
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
  white-space: normal;
}

.choice-button:hover,
.choice-button:focus,
.choice-button.is-active {
  border-color: var(--red);
  color: white;
  background: var(--red);
}

.choice-followup {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1.35;
  text-transform: uppercase;
}

textarea,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
  outline: none;
}

textarea {
  min-height: 92px;
  padding: 14px;
  resize: vertical;
}

input {
  height: 48px;
  padding: 0 14px;
}

textarea:focus,
input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 22, 31, 0.24);
}

textarea::placeholder,
input::placeholder {
  color: #6f6f6f;
}

.voice-note {
  margin: -3px 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 900;
}

.primary-button {
  color: white;
  background: var(--red);
}

.form-save {
  width: min(260px, 100%);
  margin-top: 6px;
}

.secondary-button {
  color: var(--ink);
  background: var(--pale-red);
}

.save-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--red);
  font-weight: 900;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li {
  margin: 0;
}

.history-entry {
  display: grid;
  gap: 6px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--soft);
  text-align: left;
}

.history-entry:hover {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 22, 31, 0.08);
}

.history-list strong,
.history-entry strong {
  color: var(--red);
}

.history-list span,
.history-list p,
.history-entry span,
.history-entry p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.history-list span,
.history-entry span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.history-toggle {
  width: 100%;
  margin-top: 12px;
}

.entry-dialog {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--white);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.entry-dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
}

.entry-dialog article {
  padding: 18px;
  border-top: 6px solid var(--red);
}

.dialog-content {
  display: grid;
  gap: 12px;
}

.dialog-content section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.dialog-content span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dialog-content p {
  margin: 0;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.dialog-export {
  margin-top: 14px;
}

@media (max-width: 800px) {
  .hero,
  .grid,
  .mode-tabs {
    grid-template-columns: 1fr;
  }

  .cover-card {
    width: min(220px, 100%);
  }

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

@media (max-width: 520px) {
  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 18px;
  }

  .panel-heading {
    display: grid;
  }

  .book-note::before {
    width: 128px;
  }

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