:root {
  color-scheme: light;
  --ink: #162944;
  --muted: #6b7280;
  --line: #e3dccf;
  --paper: #fbf7ef;
  --surface: #fffdf8;
  --surface-alt: #f4efe5;
  --navy: #1e2a44;
  --leaf: #6a8a6f;
  --gold: #d8b26a;
  --gold-dark: #b88b35;
  --blue: #4b718c;
  --shadow: 0 18px 44px rgba(30, 42, 68, 0.1);
  --font-body: "Yu Gothic Light", "Yu Gothic", "YuGothic", "Yu Gothic UI", "Noto Sans JP", "Meiryo", sans-serif;
  --font-display: "Yu Mincho", "YuMincho", "Hiragino Mincho ProN", "Noto Serif JP", "BIZ UDPMincho", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(216, 178, 106, 0.14), transparent 30%),
    linear-gradient(135deg, #fffaf1 0%, #f7f1e7 46%, #fbf7ef 100%);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 258px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  background: rgba(255, 253, 248, 0.78);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 28px;
}

.brand h1,
.topbar h2,
.section-heading h3,
.hero-copy h3,
.axis-panel h3,
.preview-panel h3,
.weekly-card h3 {
  font-family: var(--font-display);
  font-weight: 500;
  margin: 0;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 23px;
  font-weight: 500;
}

.brand-kicker,
.date-label,
.eyebrow {
  margin: 0 0 4px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 500;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 500;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--gold-dark);
}

.nav-item.active,
.nav-item:hover {
  background: var(--navy);
  color: #fff;
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  color: var(--gold);
}

.main {
  min-width: 0;
  padding: 28px clamp(16px, 4vw, 48px) 42px;
}

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

.topbar h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 500;
}

.top-actions,
.button-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.link-button {
  border-radius: 8px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  font-weight: 600;
}

.primary-button {
  background: var(--navy);
  color: white;
  box-shadow: 0 12px 24px rgba(30, 42, 68, 0.16);
}

.ghost-button {
  background: rgba(255, 253, 248, 0.82);
  color: var(--navy);
  border-color: var(--line);
}

.link-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--blue);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 440px);
  gap: 22px;
  align-items: stretch;
  min-height: 520px;
  padding: clamp(22px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 253, 248, 0.96), rgba(255, 253, 248, 0.62)),
    radial-gradient(circle at 78% 40%, rgba(216, 178, 106, 0.18), transparent 28%);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 18px;
  max-width: 640px;
}

.hero-copy h3 {
  max-width: 620px;
  font-family: var(--font-display);
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1.12;
  font-weight: 500;
}

.hero-copy p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.9;
}

.companion-panel {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 18px;
  min-height: 430px;
}

.speech-bubble {
  position: relative;
  max-width: 360px;
  padding: 18px 20px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--line);
  color: var(--navy);
  line-height: 1.75;
  font-weight: 500;
}

.speech-bubble p {
  margin: 0;
}

.speech-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 18px;
  transform: translateX(-50%) rotate(45deg);
  background: rgba(255, 253, 248, 0.92);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric-band {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.metric-band div,
.record-panel,
.preview-panel,
.axis-panel,
.band,
.weekly-card {
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-band div {
  padding: 16px;
}

.metric-band strong {
  font-family: var(--font-display);
  font-weight: 500;
  display: block;
  color: var(--navy);
  font-size: 30px;
  line-height: 1;
}

.metric-band span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.band,
.record-panel,
.preview-panel,
.axis-panel,
.weekly-card {
  padding: 20px;
}

.band {
  margin-top: 18px;
  box-shadow: none;
}

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

.section-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
  font-weight: 400;
}

.section-heading span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.discover-layout,
.profile-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

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

.reflection-flow {
  display: grid;
  gap: 14px;
}

.flow-progress {
  display: grid;
  gap: 8px;
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 500;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(216, 178, 106, 0.18);
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  transition: width 180ms ease;
}

.question-card,
.answer-review {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(244, 239, 229, 0.7));
}

.question-card h4,
.answer-review h4 {
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.45;
}

.question-card p,
.answer-review p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.75;
}

.question-kicker {
  color: var(--gold-dark) !important;
  font-size: 12px;
}

.question-card textarea {
  min-height: 180px;
}

.answer-review dl {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.answer-review div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-alt);
}

.answer-review dt {
  color: var(--navy);
  font-size: 12px;
}

.answer-review dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

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

textarea:focus,
input:focus,
select:focus {
  border-color: var(--gold-dark);
  box-shadow: 0 0 0 3px rgba(216, 178, 106, 0.2);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

label > span {
  color: var(--navy);
}

.recorder {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-alt);
}

.recorder p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.record-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  box-shadow: inset 0 0 0 5px rgba(216, 178, 106, 0.28), 0 10px 20px rgba(30, 42, 68, 0.2);
}

.record-button span {
  width: 16px;
  height: 22px;
  border: 3px solid #fff;
  border-radius: 10px;
  background: transparent;
  position: relative;
}

.record-button span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 8px;
  transform: translateX(-50%);
  border-bottom: 3px solid #fff;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}

.record-button.recording {
  animation: pulse 1.4s infinite;
}

.form-grid {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 12px;
  margin: 12px 0;
}

.preview-panel {
  position: sticky;
  top: 24px;
}

.entry-list {
  display: grid;
  gap: 14px;
}

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

.entry-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
}

.entry-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.entry-mood {
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(106, 138, 111, 0.14);
  color: var(--leaf);
}

.entry-card h4 {
  font-family: var(--font-display);
  margin: 12px 0 8px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.5;
}

.entry-body {
  color: var(--ink);
  line-height: 1.8;
}

.entry-insights {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.entry-insights p {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px;
  background: var(--surface-alt);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.6;
}

.entry-insights strong {
  color: var(--navy);
  font-size: 12px;
  font-weight: 500;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.search {
  max-width: 260px;
}

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

.weekly-card {
  min-height: 180px;
}

.weekly-card h3 {
  font-family: var(--font-display);
  color: var(--navy);
  font-size: 18px;
  font-weight: 500;
}

.weekly-card p,
.weekly-card li {
  color: var(--muted);
  line-height: 1.75;
  font-weight: 400;
}

.weekly-card ul {
  margin: 12px 0 0;
  padding-left: 20px;
}

.axis-list,
.profile-form {
  display: grid;
  gap: 12px;
}

.axis-item {
  border-left: 4px solid var(--gold);
  padding: 12px 14px;
  background: var(--surface-alt);
  border-radius: 8px;
}

.axis-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--navy);
  font-weight: 500;
}

.koeru-mark {
  position: relative;
  display: block;
  border: 0;
  background: transparent;
  overflow: visible;
  padding: 0;
}

.koeru-mark.mini {
  width: 56px;
  height: 68px;
}

.koeru-mark.hero {
  width: min(320px, 82vw);
  height: min(380px, 60vh);
}

.koeru-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 20px 24px rgba(30, 42, 68, 0.14));
  transition: transform 180ms ease, filter 180ms ease;
}

.koeru-mark:hover .koeru-img {
  transform: translateY(-2px);
  filter: drop-shadow(0 24px 28px rgba(30, 42, 68, 0.18));
}

.koeru-mark.mini .koeru-img {
  filter: drop-shadow(0 7px 8px rgba(30, 42, 68, 0.12));
}

@keyframes pulse {
  0% { box-shadow: inset 0 0 0 5px rgba(216, 178, 106, 0.28), 0 0 0 0 rgba(30, 42, 68, 0.25); }
  70% { box-shadow: inset 0 0 0 5px rgba(216, 178, 106, 0.28), 0 0 0 16px rgba(30, 42, 68, 0); }
  100% { box-shadow: inset 0 0 0 5px rgba(216, 178, 106, 0.28), 0 0 0 0 rgba(30, 42, 68, 0); }
}

@media (max-width: 980px) {
  .hero-panel,
  .discover-layout,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-bottom: 74px;
  }

  .sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 10;
    height: 74px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand {
    display: none;
  }

  .nav-list {
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
  }

  .nav-item {
    justify-content: center;
    padding: 10px 4px;
    font-size: 18px;
  }

  .nav-item span:not(.nav-icon) {
    display: none;
  }

  .main {
    padding: 18px 14px 28px;
  }

  .entry-list.compact,
  .metric-band,
  .weekly-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel {
    min-height: auto;
  }

  .koeru-mark.hero {
    width: 210px;
    height: 260px;
  }
}

@media (max-width: 620px) {
  .topbar {
    display: grid;
  }

  .top-actions,
  .button-row {
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 auto;
  }

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