:root {
  color-scheme: light;
  --bg: #fbeee9;        /* mymind peach base (not white) */
  --ink: #3a3d47;
  --u-sky: #9cc6e8;     /* underline sky hue */
  --muted: rgba(58, 61, 71, 0.7);
  --line: rgba(107, 111, 126, 0.16);
  --paper: #ffffff;
  --white: #ffffff;
  /* mymind palette — sampled from the real cards */
  --sage: #dcebd4;     /* mint */
  --sky: #dde4f0;      /* periwinkle */
  --butter: #f3efe2;   /* cream */
  --rose: #f6e1e6;     /* pink */
  --lilac: #e7e2f2;    /* lilac */
  --accent: #ff5a3c;   /* coral */
  --u-green: #7fc08a;  /* underline hues */
  --u-pink: #f08aa6;
  --shadow: 0 18px 50px rgba(20, 20, 20, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background: var(--bg);   /* peach base */
}

/* mymind: bottom horizontal multi-hue band, fading up into the peach */
body::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 46vh;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg,
    #f7d9d2 0%,
    #f7eccf 34%,
    #e7ddf0 67%,
    #dbe2f2 100%);
  -webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,0.55) 45%, transparent 100%);
  mask-image: linear-gradient(to top, #000 0%, rgba(0,0,0,0.55) 45%, transparent 100%);
  opacity: 0.9;
}

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

button {
  border: 0;
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 22px clamp(18px, 5vw, 58px);
  background: rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(22px);
}

.brand {
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  text-decoration: none;
}

nav {
  display: flex;
  justify-content: center;
  gap: 24px;
}

nav a {
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

main {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 54px clamp(18px, 4vw, 46px) 92px;
}

.hero {
  display: grid;
  justify-items: start;
  gap: 26px;
  max-width: 1100px;
  margin: 24px 0 72px;
  text-align: left;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(46px, 8.5vw, 112px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.01em;
}

.lead {
  max-width: 30em;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.85;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 6px;
}

.hero-note {
  color: var(--muted);
  font-size: 13px;
}

.search-orb {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(720px, 100%);
  min-height: 64px;
  margin-top: 8px;
  padding: 0 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  color: var(--muted);
}

.search-orb p {
  margin: 0;
  font-size: 15px;
}

.flow-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  width: min(980px, 100%);
  margin: 0 auto 34px;
  border: 1px solid var(--line);
  background: var(--line);
  overflow: hidden;
}

.flow-strip article {
  min-height: 190px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.62);
}

.flow-strip span,
.stats span,
.memory-item time,
.memory-item span,
.movie-preview span {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.flow-strip h2 {
  margin: 42px 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  font-weight: 500;
}

.flow-strip p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.stats,
.app-grid {
  display: grid;
  gap: 18px;
}

.stats {
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
}

.stats article,
.panel {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.stats article {
  padding: 20px;
}

.stats strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
}

.app-grid {
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  align-items: start;
  margin-bottom: 18px;
}

.panel {
  padding: 26px;
}

.record-panel {
  background: var(--white);
}

/* AI会話/Notion 取り込み = 主役ではない。控えめな折りたたみ */
.sources-fold {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.5);
  padding: 4px 18px;
}
.sources-fold > summary {
  list-style: none;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}
.sources-fold > summary::-webkit-details-marker { display: none; }
.sources-fold[open] > summary { margin-bottom: 8px; }
.sources-body { padding-bottom: 12px; }
.sources-body textarea { min-height: 120px; }

.archive-panel,
.works-panel,
.movie-panel {
  margin-bottom: 18px;
}

.panel-head,
.field-row,
.media-row,
.action-row,
.search-tools,
.studio-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-head {
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}

h2 {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 500;
  line-height: 1.08;
}

textarea,
input,
select {
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  outline: 0;
  font-size: 14px;
}

textarea {
  width: 100%;
  min-height: 178px;
  padding: 16px;
  resize: vertical;
  line-height: 1.7;
  font-size: 14px;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

.field-row,
.media-row,
.action-row,
.search-tools,
.studio-tabs {
  flex-wrap: wrap;
  margin-top: 14px;
}

.field-row input {
  min-width: 220px;
  flex: 1;
}

button,
label {
  min-height: 42px;
  font-size: 13px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.66);
}

.primary-action,
.studio-tab.active {
  color: var(--bg);
  background: #1a1a1a;
}

#photoInput {
  display: none;
}

.media-row span {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
}

.media-preview {
  margin-top: 14px;
}

.media-preview img,
.memory-image,
.handwriting-pad canvas {
  display: block;
  width: 100%;
  border-radius: 22px;
}

.memory-image {
  max-height: 260px;
  object-fit: cover;
}

.handwriting-pad {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.58);
}

.pad-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.pad-head span {
  color: var(--muted);
  font-size: 12px;
}

.pad-head div {
  display: flex;
  gap: 8px;
}

.pad-head button {
  min-height: 32px;
}

.handwriting-pad canvas {
  height: 220px;
  touch-action: none;
  background:
    linear-gradient(rgba(26, 26, 26, 0.06) 1px, transparent 1px),
    rgba(255, 255, 255, 0.86);
  background-size: 100% 36px;
  cursor: crosshair;
}

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

.memory-item,
.return-list article,
.weekly-output article,
.studio-output article,
.movie-preview section {
  min-height: 150px;
  padding: 20px 22px;
  border: 0;
  border-radius: 22px;
  background: var(--white);
}

/* mymind-style: cards carry the color, in a 5-hue rotation */
.memory-item:nth-child(5n + 1) { background: var(--butter); }
.memory-item:nth-child(5n + 2) { background: var(--sky); }
.memory-item:nth-child(5n + 3) { background: var(--rose); }
.memory-item:nth-child(5n + 4) { background: var(--sage); }
.memory-item:nth-child(5n + 5) { background: var(--lilac); }
.movie-preview section:nth-child(3) { background: var(--butter); }
.movie-preview section:nth-child(2) { background: var(--sky); }

.memory-item p {
  margin: 12px 0 0;
  line-height: 1.55;
}

.memory-item audio {
  width: 100%;
  margin-top: 14px;
}

.return-list,
.weekly-output,
.studio-output {
  display: grid;
  gap: 14px;
}

.return-list h3,
.weekly-output h3,
.studio-output h3 {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.08;
}

.return-list p,
.weekly-output p,
.studio-output p,
.studio-output ol,
.weekly-output ol {
  color: var(--muted);
  line-height: 1.65;
}

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

.movie-preview section {
  display: grid;
  align-content: space-between;
  min-height: 250px;
}

.movie-preview p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1.12;
}

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

  nav {
    display: none;
  }

  .stats,
  .app-grid,
  .memory-list,
  .movie-preview {
    grid-template-columns: 1fr;
  }
}

/* iPad portrait (≤1100px): collapse 2-col panels to a single centered column
   so the right column doesn't leave a large empty gap. Landscape stays 2-col. */
@media (min-width: 901px) and (max-width: 1100px) {
  main {
    width: min(720px, 100%);
  }

  .stats,
  .app-grid,
  .memory-list,
  .movie-preview {
    grid-template-columns: 1fr;
  }
}

/* ── auth gate (mymind palette) ───────────────────── */
.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(120% 80% at 0% 0%, var(--rose), transparent 55%),
    radial-gradient(120% 80% at 100% 100%, var(--sky), transparent 55%),
    var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  padding: 40px 34px 30px;
  border-radius: 34px;
  background: var(--white);
  box-shadow: 0 30px 90px rgba(20, 20, 20, 0.12);
  text-align: center;
}
.auth-brand {
  margin: 0 0 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
}
.auth-card h1 {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.3;
}
.auth-sub {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}
.auth-apple {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  margin-bottom: 10px;
  border: 1px solid #000;
  border-radius: 999px;
  background: #000;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.auth-apple .a {
  font-size: 17px;
  line-height: 1;
}
.auth-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 15px;
  cursor: pointer;
}
.auth-google .g {
  font-family: Georgia, serif;
  font-weight: 700;
  color: var(--accent);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-form {
  display: grid;
  gap: 10px;
}
.auth-form input {
  width: 100%;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg);
}
.auth-submit {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 15px;
}
.auth-toggle {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.auth-toggle button {
  min-height: auto;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  text-decoration: underline;
}
.auth-error {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--rose);
  color: #8a2e2e;
  font-size: 13px;
  line-height: 1.6;
}
.auth-skip {
  margin-top: 18px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
}
.topbar-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.account-email {
  color: var(--muted);
  font-size: 12px;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-account button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
}

/* ── view states: lp ↔ app ───────────────────────── */
.lp-cta {
  min-height: 54px;
  margin-top: 10px;
  padding: 0 40px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--white);
  font-size: 16px;
}
/* LP view: show hero + flow only, hide the working app */
body[data-view="lp"] .stats,
body[data-view="lp"] .app-grid,
body[data-view="lp"] .archive-panel,
body[data-view="lp"] .works-panel,
body[data-view="lp"] .movie-panel,
body[data-view="lp"] #sources,
body[data-view="lp"] nav,
body[data-view="lp"] .topbar-account { display: none; }
/* App view: hide the marketing hero/flow */
body[data-view="app"] .hero,
body[data-view="app"] .flow-strip { display: none; }
body[data-view="app"] .lp-cta { display: none; }

/* hidden attribute must win over display:grid */
.auth-gate[hidden] { display: none !important; }

.stats[hidden] { display: none !important; }
