/* kokoro: page layout and record interface */
:root {
  --ink: #4d4242;
  --muted: #887b7b;
  --paper: #fffdfc;
  --line: #eadedb;
  --accent: #a76970;
  --accent-soft: #f1dddc;
  --shadow: 0 18px 45px rgba(105, 75, 75, .12);
}

* { box-sizing: border-box; }

html { background: #eee7e4; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 3%, rgba(238, 208, 210, .75), transparent 31%),
    radial-gradient(circle at 90% 22%, rgba(221, 225, 218, .75), transparent 28%),
    linear-gradient(160deg, #fbf6f3 0%, #f5eeee 48%, #edf1ec 100%);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

.app {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(110px, calc(28px + env(safe-area-inset-bottom))) 16px;
}

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

.brand {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 14px;
  letter-spacing: .12em;
}

.profile-summary {
  max-width: 72%;
  border: 1px solid rgba(167, 105, 112, .2);
  border-radius: 999px;
  padding: 7px 10px;
  color: #786767;
  background: rgba(255, 255, 255, .54);
  font-size: 9.5px;
  line-height: 1.45;
  text-align: right;
}

.profile-summary[hidden] { display: none; }

.hero {
  padding: 10px 6px 22px;
  text-align: center;
}

.hero-mark {
  display: grid;
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  place-items: center;
  border: 1px solid rgba(167, 105, 112, .18);
  border-radius: 24px;
  background: rgba(255, 255, 255, .62);
  box-shadow: 0 12px 28px rgba(118, 86, 86, .1);
  font-size: 29px;
}

h1 {
  margin: 0 0 8px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(27px, 8vw, 34px);
  font-weight: 600;
  letter-spacing: .08em;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 28px;
  background: rgba(255, 253, 252, .88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.panel { padding: 25px 18px 20px; }
.panel[hidden] { display: none; }

.date {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
}

h2 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: .03em;
}

.hint {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.moods {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
}

.mood {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 19px;
  padding: 12px 3px 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.mood:active { transform: scale(.96); }
.mood.selected {
  border-color: var(--mood-color);
  background: color-mix(in srgb, var(--mood-color) 18%, white);
  box-shadow: inset 0 0 0 1px var(--mood-color);
}

.mood-icon { display: block; margin-bottom: 7px; font-size: 25px; }
.mood-label { display: block; font-size: 9.5px; font-weight: 700; white-space: nowrap; }

.themes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.theme {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 8px 11px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.theme-icon {
  display: block;
  margin-bottom: 5px;
  font-size: 22px;
  line-height: 1;
}

.theme-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.45;
}

.theme:last-child { grid-column: 1 / -1; }
.theme.selected {
  border-color: var(--accent);
  color: #784e55;
  background: var(--accent-soft);
}

.actions { display: flex; gap: 10px; margin-top: 21px; }

.btn {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 15px 16px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .04em;
}

.btn-primary { color: #fff; background: var(--accent); box-shadow: 0 10px 24px rgba(167, 105, 112, .24); }
.btn-primary:disabled { opacity: .38; cursor: default; box-shadow: none; }
.btn-ghost { width: auto; color: var(--muted); background: #f5efed; }

.watashi-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1px solid rgba(167, 105, 112, .24);
  border-radius: 16px;
  padding: 14px 12px;
  color: #784e55;
  background: #fff7f8;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: .03em;
}

.rhythm-entry {
  margin-top: 15px;
  border: 1px solid rgba(167, 105, 112, .18);
  border-radius: 24px;
  padding: 20px 18px;
  background: rgba(255, 253, 252, .78);
  box-shadow: 0 12px 30px rgba(105, 75, 75, .08);
  text-align: center;
}
.rhythm-entry small { display: block; margin-bottom: 5px; color: var(--accent); font-weight: 700; }
.rhythm-entry h2 { margin-bottom: 8px; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 19px; }
.rhythm-entry p { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.75; }
.rhythm-entry a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px; padding: 10px 20px; color: #fff; background: var(--accent); text-decoration: none; font-size: 13px; font-weight: 700; }

.saved { padding: 29px 20px 23px; text-align: center; }
.saved-icon { margin-bottom: 12px; font-size: 44px; }
.saved h2 { font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; }
.saved-copy { margin: 0 0 21px; color: var(--muted); font-size: 13px; line-height: 1.8; }

.summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-bottom: 18px;
  text-align: left;
}

.summary-item { border-radius: 16px; padding: 13px; background: #f7f1ef; }
.summary-title { margin-bottom: 4px; color: var(--muted); font-size: 10px; }
.summary-value { font-size: 13px; font-weight: 700; }

.navigator-question {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: end;
  gap: 4px;
  margin: 2px -5px 17px -12px;
}

.navigator-portrait {
  display: block;
  width: 126px;
  max-width: none;
  margin: 0 -8px -2px 0;
  filter: drop-shadow(0 12px 16px rgba(91, 68, 75, .1));
}

.question {
  position: relative;
  margin: 0 0 10px;
  border: 1px solid #eadfda;
  border-radius: 18px 18px 18px 5px;
  padding: 15px;
  background: rgba(255, 255, 255, .96);
  text-align: left;
  box-shadow: 0 10px 24px rgba(105, 75, 75, .06);
}

.question::before {
  position: absolute;
  bottom: 17px;
  left: -8px;
  width: 14px;
  height: 14px;
  border-bottom: 1px solid #eadfda;
  border-left: 1px solid #eadfda;
  background: #fff;
  content: "";
  transform: rotate(45deg);
}

.question small { display: block; margin-bottom: 5px; color: var(--accent); font-weight: 700; }
.question p { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", serif; font-size: 15px; line-height: 1.7; }

.history { margin-top: 15px; padding: 22px 18px 20px; }

.history-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.history h2 { margin: 0; font-size: 17px; }
.streak { color: var(--accent); font-size: 11px; font-weight: 700; }

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day { text-align: center; }
.day-name { display: block; margin-bottom: 6px; color: #9b9090; font-size: 9px; }
.day-dot {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 1px dashed #ded3d0;
  border-radius: 13px;
  padding: 0;
  color: #8a7d7d;
  background: rgba(255,255,255,.58);
  font-family: inherit;
  font-size: 11px;
}

.day-dot.filled { border-style: solid; border-color: transparent; background: var(--dot-color); cursor: pointer; }
.day-dot.filled:active { transform: scale(.94); }
.day-dot:disabled { opacity: 1; }
.day-dot.today { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--accent); }
.day-dot.just-added { animation: dayAdded .72s ease both; }
@keyframes dayAdded {
  0% { opacity: .35; transform: scale(.72); }
  60% { transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}

.history-summary {
  margin: 14px 0 0;
  color: #76696c;
  font-size: 12px;
  line-height: 1.75;
  text-align: center;
}

.history-milestone {
  margin: 9px 0 0;
  border-top: 1px solid #eee3df;
  padding-top: 11px;
  color: var(--accent);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

.history-hint {
  margin: 11px 0 0;
  color: #978b8b;
  font-size: 10px;
  text-align: center;
}

.history-detail {
  margin-top: 16px;
  border: 1px solid #eadfda;
  border-radius: 18px;
  padding: 16px;
  background: rgba(255,255,255,.78);
}

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

.history-detail-date { margin: 0; color: var(--accent); font-size: 12px; font-weight: 700; }
.history-detail-close { border: 0; padding: 4px 7px; color: #8e8080; background: transparent; font-size: 11px; cursor: pointer; }
.history-detail .summary { margin: 0; }

.note {
  margin: 15px 8px 0;
  color: #978b8b;
  font-size: 10px;
  line-height: 1.7;
  text-align: center;
}

.footer-nav { display: flex; justify-content: center; gap: 18px; margin-top: 20px; }
.footer-nav button { border: 0; padding: 6px; color: #8e8080; background: transparent; font-size: 11px; cursor: pointer; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 10;
  transform: translate(-50%, 16px);
  width: max-content;
  max-width: calc(100vw - 40px);
  border-radius: 999px;
  padding: 11px 16px;
  color: #fff;
  background: rgba(75, 62, 62, .92);
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: .2s ease;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.corner-links {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: calc(72px + env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  gap: 7px;
}

.corner-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 44px;
  border: 1px solid rgba(167, 105, 112, .16);
  border-radius: 14px;
  padding: 9px 13px;
  color: #725e61;
  background: rgba(255, 253, 252, .94);
  box-shadow: 0 5px 16px rgba(105, 75, 75, .1);
  text-align: center;
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .02em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.corner-links a:hover,
.corner-links a:focus-visible {
  background: #fff8f9;
  box-shadow: 0 7px 20px rgba(105, 75, 75, .15);
}

.corner-links a:focus-visible { outline: 2px solid #a76970; outline-offset: 3px; }
.corner-links a:active { transform: scale(.98); }

@media (min-width: 700px) {
  .app { width: min(100%, 560px); min-height: auto; margin-top: 30px; margin-bottom: 30px; border-radius: 34px; }
}

@media (max-width: 699px) {
  .app {
    padding-right: max(16px, env(safe-area-inset-right));
    padding-bottom: max(108px, calc(28px + env(safe-area-inset-bottom)));
  }
  .topbar { align-items: flex-start; gap: 8px; }
  .brand { flex: 0 0 auto; }
  .profile-summary { max-width: calc(100% - 92px); border: 0; padding: 1px 0; background: transparent; font-size: 9px; }

  .navigator-question {
    grid-template-columns: 98px minmax(0, 1fr);
    margin-left: -10px;
  }
  .navigator-portrait { width: 112px; }
  .toast { bottom: max(24px, env(safe-area-inset-bottom)); }
}
