/* ===== アイス食べ歩きノート — パステル文具スタイル ===== */
:root {
  --pink-50: #fff5f8;
  --pink-100: #ffe6ef;
  --pink-200: #ffd0e0;
  --pink-300: #ffb3cf;
  --pink-500: #ff8bb5;
  --mint-100: #e4f7f0;
  --mint-200: #c7efe3;
  --mint-300: #a3e4d2;
  --mint-500: #4fc4a8;
  --cream: #fffdf8;
  --ink: #5b4a52;
  --ink-soft: #8a7780;
  --line: #f2dbe4;
  --yellow: #ffe08a;
  --shadow-sm: 0 2px 8px rgba(180, 120, 150, 0.14);
  --shadow-md: 0 8px 24px rgba(180, 120, 150, 0.18);
  --radius: 18px;
  --font-body: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro",
    "Rounded Mplus 1c", "Quicksand", "Segoe UI", system-ui, sans-serif;
  --font-num: "Quicksand", "Poppins", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--mint-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
/* fixed photographic background + readable veil (no background-attachment:fixed,
   which causes repaint jank on mobile) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(160deg, rgba(255, 245, 248, 0.84), rgba(228, 247, 240, 0.84)),
    url("assets/background.png") center / cover no-repeat,
    var(--mint-100);
  z-index: -1;
}

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ===== Masthead ===== */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, var(--pink-200), var(--mint-200));
  border: 3px solid #fff;
  border-radius: 26px;
  padding: 16px 22px;
  box-shadow: var(--shadow-md);
}
.masthead__brand { display: flex; align-items: center; gap: 12px; }
.masthead__cone { font-size: 2.6rem; filter: drop-shadow(0 3px 2px rgba(255, 139, 181, 0.4)); }
.masthead__title {
  margin: 0;
  font-size: clamp(1.4rem, 4.5vw, 2.1rem);
  letter-spacing: 0.04em;
  color: #d65f8e;
  text-shadow: 0 2px 0 #fff;
}
.masthead__tagline { margin: 2px 0 0; font-size: 0.86rem; color: var(--ink-soft); }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--primary {
  background: linear-gradient(120deg, var(--pink-500), var(--pink-300));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--primary:hover { box-shadow: var(--shadow-md); }
.btn--share {
  background: linear-gradient(120deg, var(--mint-500), var(--mint-300));
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn--ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
}
.btn--ghost:hover { border-color: var(--pink-300); }
.btn--danger { background: linear-gradient(120deg, #ff7a9a, #ff9bb0); }
.btn--danger-ghost { color: #d65f7a; border-color: #ffd0d8; }

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 18px 0;
}
.stat-chip {
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.stat-chip--accent { background: linear-gradient(160deg, #fff, var(--pink-100)); border-color: var(--pink-200); }
.stat-chip__label { display: block; font-size: 0.74rem; color: var(--ink-soft); }
.stat-chip__value {
  display: block;
  font-family: var(--font-num);
  font-size: 1.7rem;
  font-weight: 700;
  color: #d65f8e;
  margin-top: 2px;
}
.stat-chip__value small { font-size: 0.8rem; margin-left: 2px; }
.stat-chip__value--text { font-size: 1.05rem; line-height: 1.3; word-break: break-word; }

/* ===== Layout ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 18px;
  align-items: start;
}

/* ===== Section titles ===== */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 1.2rem;
  color: #c95c84;
}
.section-title__sticker {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: var(--mint-200);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #fff;
}

/* ===== Record card ===== */
.record-card {
  position: relative;
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}
.record-card__tape {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 120px;
  height: 26px;
  background: repeating-linear-gradient(45deg, rgba(255,255,255,0.5) 0 8px, rgba(163,228,210,0.55) 8px 16px);
  border: 1px dashed rgba(255,255,255,0.8);
  border-radius: 4px;
  opacity: 0.9;
}

/* Photo */
.photo-zone { text-align: center; margin-bottom: 16px; }
.photo-frame {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 25%, var(--pink-100), transparent 60%),
    repeating-linear-gradient(135deg, var(--mint-100) 0 14px, #fff 14px 28px);
  border: 4px solid #fff;
  box-shadow: var(--shadow-sm), inset 0 0 0 2px var(--pink-200);
  display: grid;
  place-items: center;
}
.photo-frame__shot { width: 100%; height: 100%; object-fit: cover; }
.photo-frame__placeholder { display: grid; gap: 4px; color: var(--ink-soft); }
.photo-frame__emoji { font-size: 3rem; }
.photo-frame__hint { font-size: 0.82rem; }
.photo-actions { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.photo-note { font-size: 0.72rem; color: var(--ink-soft); margin: 8px 0 0; }

/* Fields */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 4px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field--wide { grid-column: 1 / -1; }
.field__label { font-size: 0.82rem; font-weight: 700; color: var(--ink-soft); }
.field__label em { color: var(--pink-500); font-style: normal; }
input[type="text"], input[type="number"], input[type="date"], input[type="search"],
textarea, select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--pink-300);
  box-shadow: 0 0 0 3px var(--pink-100);
}
textarea { resize: vertical; }
.field input:invalid { border-color: var(--line); }

/* Flavor chips */
.flavor-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.flavor-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mint-200);
  color: #2f8a74;
  border-radius: 999px;
  padding: 4px 8px 4px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.flavor-chip button {
  border: none;
  background: rgba(255,255,255,0.7);
  color: #2f8a74;
  width: 18px; height: 18px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  display: grid; place-items: center;
}
.flavor-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.flavor-suggest[aria-hidden="true"] { display: none; }
.flavor-suggest__pill {
  background: #fff;
  border: 2px dashed var(--pink-200);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  cursor: pointer;
}
.flavor-suggest__pill:hover { background: var(--pink-50); color: var(--pink-500); }

/* Ratings */
.rating-block {
  background: var(--pink-50);
  border: 2px dashed var(--pink-200);
  border-radius: 16px;
  padding: 14px;
  margin: 14px 0;
  display: grid;
  gap: 12px;
}
.rating-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.rating-row__label { font-weight: 700; color: var(--ink-soft); font-size: 0.9rem; }
.stars { display: inline-flex; gap: 2px; }
.stars button {
  border: none;
  background: none;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
  color: #e9d5dd;
  transition: transform 0.1s ease, color 0.1s ease;
  padding: 0 1px;
}
.stars button.on { color: var(--yellow); transform: scale(1.05); }
.stars button:hover { transform: scale(1.18); }

.meter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.meter { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: 0.84rem; font-weight: 700; color: var(--ink-soft); }
.meter output {
  font-family: var(--font-num);
  background: #fff;
  border-radius: 8px;
  padding: 1px 8px;
  color: var(--pink-500);
  min-width: 26px;
  text-align: center;
}
input[type="range"] { -webkit-appearance: none; appearance: none; height: 8px; border-radius: 999px; background: var(--mint-200); padding: 0; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--pink-500); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--pink-500); border: 3px solid #fff; cursor: pointer; }

.repeat-toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; }
.repeat-toggle input { width: 20px; height: 20px; accent-color: var(--pink-500); }
.repeat-toggle__face { color: #d65f7a; }

.form-actions { display: flex; gap: 10px; margin-top: 6px; }
.form-actions .btn--primary { flex: 1; justify-content: center; }

/* ===== History ===== */
.history {
  background: var(--cream);
  border: 2px solid var(--line);
  border-radius: 24px;
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}
.history__count { font-size: 0.82rem; color: var(--ink-soft); font-weight: 400; margin-left: auto; }

.filters { display: grid; gap: 10px; margin-bottom: 16px; }
.filters__selects { display: flex; flex-wrap: wrap; gap: 8px; }
.filters__selects select { width: auto; flex: 1 1 auto; min-width: 96px; font-size: 0.85rem; padding: 7px 10px; }
.repeat-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 700; color: #d65f7a; cursor: pointer; }
.repeat-filter input { accent-color: var(--pink-500); width: 16px; height: 16px; }

/* Stamp grid */
.stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.stamp {
  position: relative;
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
  display: flex;
  flex-direction: column;
}
.stamp:hover { transform: translateY(-3px) rotate(-0.6deg); box-shadow: var(--shadow-md); }
.stamp:focus-visible { outline: 3px solid var(--pink-300); outline-offset: 2px; }
.stamp__thumb {
  aspect-ratio: 1 / 1;
  background: repeating-linear-gradient(135deg, var(--mint-100) 0 12px, #fff 12px 24px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.stamp__thumb img { width: 100%; height: 100%; object-fit: cover; }
.stamp__placeholder { font-size: 2.6rem; }
.stamp__repeat {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(255,255,255,0.92);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.78rem;
  box-shadow: var(--shadow-sm);
}
.stamp__body { padding: 8px 10px 10px; display: grid; gap: 3px; }
.stamp__name { font-weight: 700; font-size: 0.92rem; line-height: 1.25; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stamp__meta { font-size: 0.74rem; color: var(--ink-soft); display: flex; flex-wrap: wrap; gap: 4px 8px; }
.stamp__stars { color: var(--yellow); font-size: 0.82rem; letter-spacing: 1px; }
.stamp__tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.stamp__tag { background: var(--pink-100); color: #c95c84; border-radius: 999px; padding: 1px 7px; font-size: 0.68rem; font-weight: 700; }

/* Empty states */
.empty { text-align: center; padding: 28px 12px; color: var(--ink-soft); }
.empty--mini { padding: 18px 12px; }
.empty__img { width: 160px; max-width: 60%; height: auto; margin-bottom: 8px; filter: drop-shadow(0 6px 10px rgba(180,120,150,0.18)); }
.empty__title { font-weight: 700; color: #c95c84; margin: 4px 0; }
.empty__text { font-size: 0.86rem; margin: 0; }

/* Footer */
.page-footer { text-align: center; margin-top: 30px; font-size: 0.76rem; color: var(--ink-soft); }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(120, 80, 100, 0.34); backdrop-filter: blur(2px); }
.modal__panel {
  position: relative;
  background: var(--cream);
  border: 3px solid #fff;
  border-radius: 22px;
  box-shadow: var(--shadow-md);
  max-width: 440px;
  width: 100%;
  padding: 24px 22px;
  animation: pop 0.18s ease;
}
.modal__panel--detail { max-width: 480px; max-height: 88vh; overflow-y: auto; }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal__x { position: absolute; top: 10px; right: 12px; border: none; background: var(--pink-100); width: 30px; height: 30px; border-radius: 50%; font-size: 1.2rem; cursor: pointer; color: #c95c84; }
.modal__title { margin: 0 0 8px; color: #c95c84; }
.modal__message { margin: 0 0 18px; color: var(--ink); }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

/* Detail content */
.detail__photo { width: 100%; border-radius: 14px; aspect-ratio: 4/3; object-fit: cover; border: 4px solid #fff; box-shadow: var(--shadow-sm); margin-bottom: 12px; background: var(--mint-100); }
.detail__photo--ph { display: grid; place-items: center; font-size: 3.5rem; }
.detail__name { margin: 0 0 4px; font-size: 1.3rem; color: #c95c84; }
.detail__sub { font-size: 0.86rem; color: var(--ink-soft); margin: 0 0 12px; }
.detail__row { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 8px 0; font-size: 0.9rem; }
.detail__row b { color: var(--ink-soft); font-weight: 700; }
.detail__memo { background: var(--pink-50); border-radius: 12px; padding: 10px 12px; font-size: 0.9rem; white-space: pre-wrap; margin: 10px 0; border: 1px dashed var(--pink-200); }
.detail__tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

/* ===== Toast ===== */
.toast-stack { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.toast {
  background: #fff;
  border: 2px solid var(--mint-300);
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease;
}
.toast--warn { border-color: var(--pink-300); }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { transform: translateY(-8px); opacity: 0; } }

/* ===== Responsive ===== */
@media (max-width: 760px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr; }
  .meter-grid { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .stamp-grid { grid-template-columns: 1fr 1fr; }
  .stars button { font-size: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
