:root {
  --bg: #fbf7f4;
  --surface: #ffffff;
  --ink: #2d2833;
  --muted: #7a7282;
  --line: #ece4ea;
  --accent: #e0668f;
  --accent-soft: #fde9f0;
  --accent-ink: #ffffff;
  --shadow: 0 6px 24px rgba(80, 50, 70, 0.08);
  --radius: 18px;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Zen Maru Gothic", system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(251, 247, 244, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.02em;
}
.brand span { display: block; font-size: 11px; color: var(--muted); font-weight: 500; line-height: 1; }

.top-right { display: flex; align-items: center; gap: 8px; }
.account {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.button.small { padding: 7px 14px; font-size: 13px; margin-bottom: 16px; }

.sheet { border: 0; padding: 20px; border-radius: 18px; width: min(92vw, 420px); background: var(--surface); color: var(--ink); }
.sheet::backdrop { background: rgba(30, 20, 30, 0.5); }
.sheet h2 { margin-top: 0; }
.sheet label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.sheet input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.sheet input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-status { font-size: 13px; color: var(--muted); margin: 10px 0 0; min-height: 1em; }

.tabs { display: flex; gap: 4px; background: var(--surface); padding: 4px; border-radius: 999px; border: 1px solid var(--line); }
.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.tabs button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }

main { max-width: 720px; margin: 0 auto; padding: 16px 16px 32px; }

.intro h1 { font-size: 26px; line-height: 1.4; margin: 12px 0 8px; }
.intro p { margin: 0 0 20px; color: var(--muted); }

h2 { font-size: 21px; margin: 12px 0 4px; }
.sub { color: var(--muted); margin: 0 0 16px; font-size: 14px; }

.notice {
  background: var(--accent-soft);
  border: 1px solid #f6c9d8;
  color: #8a2c4d;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.question { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 10px; margin-bottom: 12px; box-shadow: var(--shadow); }
.question h3 { margin: 0 0 8px; font-size: 15px; }
.question h3 small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.question h4 { margin: 8px 0 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.question .hint { font-size: 12px; color: var(--muted); margin: 6px 0 0; }

.optional { margin: 4px 0 12px; }
.optional summary { cursor: pointer; color: var(--muted); padding: 8px 4px; font-size: 14px; }

.turnstile { margin: 8px 0; display: flex; justify-content: center; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
}
.button.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px rgba(224, 102, 143, 0.3); }
.button.primary:disabled { background: #e8d9df; box-shadow: none; cursor: not-allowed; }
.button.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.button.support { background: #fff5e6; border-color: #f3dcb5; color: #8a5a12; }
.remaining { width: 100%; margin: 0; font-size: 13px; color: var(--muted); }

.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0 16px; }
.progress span { display: block; height: 100%; width: 5%; background: var(--accent); border-radius: 999px; transition: width 0.8s ease; }

.persona {
  white-space: pre-line;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 16px;
  box-shadow: var(--shadow);
}

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card {
  position: relative;
  border: 2px solid transparent;
  border-radius: 14px;
  background: var(--surface);
  overflow: hidden;
  aspect-ratio: 2 / 3;
  padding: 0;
  cursor: default;
  box-shadow: var(--shadow);
}
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.ready { cursor: pointer; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card .label {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}
.card .zoom {
  position: absolute;
  right: 6px;
  bottom: 6px;
  border: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  padding: 2px 10px;
  cursor: pointer;
}
.card .state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 8px;
}
.card.waiting {
  background: linear-gradient(110deg, #f6eef2 30%, #fff 50%, #f6eef2 70%);
  background-size: 250% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -150% 0; } }

.mine { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mine article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.mine img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; cursor: zoom-in; }
.mine p { margin: 8px 10px 10px; font-size: 13px; white-space: pre-line; }
.mine time { display: block; margin: 0 10px 10px; font-size: 11px; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

.foot { max-width: 720px; margin: 0 auto; padding: 8px 16px 40px; text-align: center; color: var(--muted); font-size: 12px; }

.viewer { border: 0; padding: 12px; border-radius: 16px; max-width: min(92vw, 560px); background: var(--surface); }
.viewer::backdrop { background: rgba(30, 20, 30, 0.6); }
.viewer img { width: 100%; height: auto; display: block; border-radius: 10px; margin-bottom: 10px; }
.viewer form { text-align: center; }

@media (max-width: 420px) {
  .brand span { display: none; }
  .tabs button { padding: 6px 10px; }
  .intro h1 { font-size: 23px; }
  .cards { gap: 6px; }
  .brand { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.waiting { animation: none; }
  .progress span { transition: none; }
}
