:root {
  --cream: #fff8e6;
  --cream-strong: #fff0bf;
  --custard: #ffd978;
  --custard-deep: #efb94a;
  --caramel: #6b421f;
  --cocoa: #3f2a1d;
  --soft-brown: #9b704b;
  --pink: #ffdbe8;
  --sky: #dff4ff;
  --mint: #dbf7d2;
  --paper: rgba(255, 255, 255, 0.9);
  --line: rgba(207, 156, 79, 0.42);
  --shadow: 0 14px 34px rgba(123, 79, 31, 0.11);
  --radius: 8px;
  --font-cute: "Wawati SC", "Wawati TC", "Yuanti SC", "Hiragino Maru Gothic ProN", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--caramel);
  background:
    linear-gradient(180deg, rgba(255, 217, 120, 0.45) 0, rgba(255, 248, 230, 0) 360px),
    radial-gradient(circle at 12% 18%, rgba(255, 219, 232, 0.48), transparent 240px),
    linear-gradient(160deg, #fff8e6 0%, #fffdf4 48%, #eaf8ff 100%);
  font-family: var(--font-cute);
  font-weight: 500;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

input,
textarea,
select {
  width: 100%;
  color: var(--cocoa);
  background: #fffdf5;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--custard-deep);
  box-shadow: 0 0 0 3px rgba(255, 217, 120, 0.28);
}

textarea {
  min-height: 106px;
  resize: vertical;
}

img {
  max-width: 100%;
  display: block;
}

.app-shell {
  width: 100%;
  max-width: 680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 16px calc(112px + env(safe-area-inset-bottom));
}

.bind-shell {
  max-width: 620px;
  padding-bottom: 42px;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px;
  gap: 16px;
  align-items: center;
  min-height: 230px;
  padding: 26px 22px;
  overflow: hidden;
  background: linear-gradient(145deg, #ffe58f 0%, #fff5cf 54%, #ffdce9 100%);
  border: 1px solid rgba(209, 153, 61, 0.55);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  right: -90px;
  bottom: -74px;
  width: 230px;
  height: 130px;
  content: "";
  background: rgba(255, 255, 255, 0.46);
  border-radius: 50%;
}

.hero-copy,
.hero-characters {
  position: relative;
  z-index: 1;
}

.eyebrow,
.section-kicker,
.mini-label {
  display: block;
  color: #ad741f;
  font-size: 12px;
  font-weight: 700;
}

.hero-title,
.page-title {
  display: block;
  margin: 8px 0 0;
  color: #573720;
  font-size: clamp(30px, 8vw, 43px);
  line-height: 1.08;
  font-weight: 700;
}

.page-title {
  font-size: clamp(25px, 6.5vw, 34px);
}

.hero-subtitle,
.page-copy {
  margin: 12px 0 0;
  color: #845f3d;
  font-size: 15px;
  line-height: 1.7;
}

.hero-characters {
  height: 172px;
}

.hero-purin {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 148px;
  height: 148px;
  object-fit: contain;
}

.hero-muffin {
  position: absolute;
  left: 0;
  bottom: 8px;
  width: 70px;
  height: 82px;
  object-fit: contain;
}

.page-hero {
  min-height: 168px;
  margin-bottom: 16px;
}

.page-hero .hero-characters {
  height: 136px;
}

.page-hero .hero-purin {
  width: 120px;
  height: 120px;
}

.page-hero .hero-muffin {
  width: 58px;
  height: 68px;
}

.section-card {
  width: 100%;
  margin-top: 16px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-heading,
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title {
  display: block;
  margin-top: 4px;
  color: #54351f;
  font-size: 20px;
  font-weight: 700;
}

.section-note {
  color: #9b704b;
  font-size: 13px;
  line-height: 1.45;
}

.soft-input,
.soft-textarea,
.soft-select {
  min-height: 48px;
  margin-top: 12px;
  padding: 0 14px;
  font-size: 16px;
}

.soft-textarea {
  padding: 13px 14px;
}

.form-label {
  display: block;
  margin: 18px 0 10px;
  color: #5b3921;
  font-size: 16px;
  font-weight: 700;
}

.button-row,
.chip-row,
.mood-row,
.image-list,
.tab-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.soft-button,
.danger-button,
.icon-button,
.text-button,
.tab-chip,
.mood-chip,
.segment,
.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  color: #6a421e;
  background: #fff4cb;
  border: 1px solid rgba(214, 158, 54, 0.54);
  border-radius: var(--radius);
  font-weight: 700;
  text-align: center;
}

.primary-button {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  background: #ffd96f;
  border-color: #dfaa35;
}

.soft-button {
  background: #fffaf0;
}

.danger-button {
  color: #9b2b20;
  background: #ffe8e4;
  border-color: rgba(198, 73, 55, 0.35);
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  color: #a26718;
  background: transparent;
}

.icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
}

.tiny-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

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

.segment.active,
.tab-chip.active,
.mood-chip.active {
  color: #4f3118;
  background: #ffd96f;
  border-color: #c88c26;
  box-shadow: inset 0 -2px 0 rgba(116, 70, 23, 0.13);
}

.route-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.route-card {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 24px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 112px;
  padding: 18px;
  text-align: left;
  background: #fffdf4;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(123, 79, 31, 0.08);
}

.route-card.record {
  background: linear-gradient(120deg, #fff0b8 0%, #fffdf4 100%);
}

.route-card.archive {
  background: linear-gradient(120deg, #ddf4ff 0%, #fffdf4 100%);
}

.route-card.kitchen {
  background: linear-gradient(120deg, #ffe3cc 0%, #fffdf4 100%);
}

.route-card.daily {
  background: linear-gradient(120deg, #ffddea 0%, #fffdf4 100%);
}

.route-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(214, 158, 54, 0.24);
  border-radius: 50%;
  font-size: 29px;
}

.route-title {
  display: block;
  color: #54351f;
  font-size: 20px;
  font-weight: 700;
}

.route-subtitle {
  display: block;
  margin-top: 7px;
  color: #8f6948;
  font-size: 14px;
  line-height: 1.45;
}

.route-arrow {
  color: #bb8529;
  font-size: 30px;
}

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

.count-item {
  padding: 16px;
  background: #fff9e8;
  border: 1px solid rgba(216, 166, 85, 0.35);
  border-radius: var(--radius);
  text-align: center;
}

.count-label,
.count-note {
  display: block;
  color: #9a7352;
  font-size: 13px;
}

.count-value {
  display: block;
  margin: 8px 0 4px;
  color: #5e3a1d;
  font-size: 27px;
  font-weight: 700;
}

.status-list,
.history-list,
.note-list,
.wish-list,
.order-list,
.dish-list,
.archive-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.person-status,
.history-row,
.note-row,
.wish-row,
.order-row,
.dish-card,
.archive-record,
.anniversary-row {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fffaf0;
  border: 1px solid rgba(216, 166, 85, 0.28);
  border-radius: var(--radius);
}

.person-status,
.history-row,
.archive-record {
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: start;
}

.tiny-character,
.record-avatar {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.person-line,
.history-top,
.record-top,
.dish-top,
.comment-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.person-name,
.history-name,
.record-name,
.dish-title,
.anniversary-title,
.room-title,
.comment-author {
  color: #56361e;
  font-weight: 700;
}

.person-tag,
.dish-tag,
.order-status,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  color: #9a6314;
  background: #fff0bf;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-text,
.history-status,
.record-status {
  display: block;
  margin-top: 8px;
  color: #604023;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.status-note,
.history-detail,
.record-place,
.history-time,
.record-time,
.note-meta,
.comment-time,
.anniversary-date,
.order-meta {
  display: block;
  color: #9a7352;
  font-size: 13px;
  line-height: 1.55;
}

.history-note,
.record-note,
.note-text,
.comment-text,
.dish-desc {
  display: block;
  margin-top: 8px;
  color: #624329;
  font-size: 15px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

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

.status-option,
.custom-status-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 96px;
  padding: 12px;
  border: 1px solid rgba(177, 120, 34, 0.35);
  border-radius: var(--radius);
  text-align: left;
}

.status-option.active,
.custom-status-card.active {
  outline: 3px solid rgba(221, 166, 53, 0.35);
}

.status-icon-wrap {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 50%;
  font-size: 24px;
}

.status-name {
  display: block;
  color: #54351f;
  font-size: 16px;
  font-weight: 700;
}

.status-hint {
  display: block;
  margin-top: 5px;
  color: #8d6646;
  font-size: 13px;
  line-height: 1.35;
}

.status-badge {
  grid-column: 2;
  justify-self: start;
}

.custom-status-card {
  margin-top: 10px;
  background: #fff6d8;
}

.custom-status-form {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.custom-status-form .custom-hint {
  grid-column: 1 / -1;
}

.auto-time-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: #edf8ff;
  border: 1px solid rgba(102, 172, 209, 0.28);
  border-radius: var(--radius);
}

.auto-time-label,
.auto-time-note {
  color: #597891;
  font-size: 13px;
  font-weight: 700;
}

.auto-time-value {
  display: block;
  margin-top: 4px;
  color: #3f2a1d;
  font-size: 15px;
  line-height: 1.5;
}

.image-uploader {
  margin-top: 14px;
}

.image-thumb,
.image-add {
  position: relative;
  width: 92px;
  aspect-ratio: 1;
  overflow: hidden;
  background: #fff6d8;
  border: 1px dashed #d49b37;
  border-radius: var(--radius);
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  color: #8a2a20;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  font-weight: 700;
}

.image-add {
  display: grid;
  place-items: center;
  color: #9a6314;
  font-weight: 700;
}

.history-images,
.record-images {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.history-image,
.record-image {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid rgba(216, 166, 85, 0.32);
  border-radius: var(--radius);
}

.comment-panel {
  margin-top: 12px;
  padding: 12px;
  background: #fffdf7;
  border: 1px solid rgba(216, 166, 85, 0.26);
  border-radius: var(--radius);
}

.comment-heading,
.comment-input-row,
.replying-row,
.room-actions,
.kitchen-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.comment-heading {
  justify-content: space-between;
}

.comment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  margin-top: 10px;
}

.comment-bubble {
  padding: 10px;
  background: #fff7df;
  border-radius: var(--radius);
}

.reply-label,
.record-reply-label {
  display: block;
  margin-top: 6px;
  color: #bd7f22;
  font-size: 12px;
  font-weight: 700;
}

.comment-input-row {
  margin-top: 10px;
}

.comment-input-row input {
  min-height: 42px;
  padding: 0 12px;
}

.empty-card,
.soft-empty {
  color: #94704e;
  line-height: 1.55;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.category-tabs .tab-chip {
  flex: 0 0 auto;
}

.dish-actions,
.order-actions,
.history-actions,
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.order-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.wish-row {
  grid-template-columns: 38px minmax(0, 1fr) 38px;
  align-items: center;
}

.wish-row.done .wish-title {
  color: #a18a70;
  text-decoration: line-through;
}

.wish-check {
  width: 32px;
  height: 32px;
  color: #5b3921;
  background: #fff2bf;
  border: 1px solid rgba(214, 158, 54, 0.5);
  border-radius: 50%;
  font-weight: 700;
}

.anniversary-composer,
.nickname-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.room-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: #fff7dc;
  border: 1px solid rgba(214, 158, 54, 0.32);
  border-radius: var(--radius);
}

.room-avatar {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.pair-code {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  margin-top: 6px;
  padding: 0 12px;
  color: #4f3118;
  background: #ffd96f;
  border: 1px solid #d6a03c;
  border-radius: var(--radius);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
}

.notice-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  background: #edf8ff;
  border: 1px solid rgba(98, 166, 204, 0.28);
  border-radius: var(--radius);
}

.archive-filter {
  display: grid;
  gap: 12px;
}

.day-strip,
.person-filter {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-chip,
.person-chip {
  flex: 0 0 auto;
  min-width: 112px;
  padding: 10px 12px;
  background: #fffaf0;
  border: 1px solid rgba(216, 166, 85, 0.35);
  border-radius: var(--radius);
  font-weight: 700;
}

.day-chip.active,
.person-chip.active {
  background: #ffd96f;
  border-color: #c88c26;
}

.day-chip-sub {
  display: block;
  margin-top: 4px;
  color: #8f6948;
  font-size: 12px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 30;
  width: min(680px, 100%);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(255, 253, 244, 0.94);
  border-top: 1px solid rgba(207, 156, 79, 0.38);
  box-shadow: 0 -10px 26px rgba(119, 74, 28, 0.12);
  backdrop-filter: blur(16px);
}

.tabbar-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.tab-item {
  display: grid;
  gap: 3px;
  place-items: center;
  min-height: 56px;
  color: #8f6948;
  background: transparent;
  border-radius: var(--radius);
}

.tab-item.active {
  color: #4f3118;
  background: #fff0bf;
  box-shadow: inset 0 0 0 1px rgba(214, 158, 54, 0.48);
}

.tab-icon {
  font-size: 21px;
  line-height: 1;
}

.tab-text {
  font-size: 13px;
  font-weight: 700;
}

.setup-warning {
  margin-top: 16px;
  padding: 12px;
  color: #755223;
  background: #fff4cf;
  border: 1px solid rgba(214, 158, 54, 0.42);
  border-radius: var(--radius);
  line-height: 1.55;
}

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 217, 120, 0.35);
}

.loading-bar::after {
  display: block;
  width: 38%;
  height: 100%;
  content: "";
  background: #d99d2c;
  animation: loading 1.1s ease-in-out infinite;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 50;
  max-width: min(520px, calc(100% - 32px));
  padding: 11px 14px;
  color: #fffdf7;
  background: rgba(83, 53, 28, 0.92);
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

.hidden {
  display: none !important;
}

@keyframes loading {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(280%);
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 122px;
    min-height: 210px;
    padding: 22px 16px;
  }

  .hero-characters {
    height: 138px;
  }

  .hero-purin {
    width: 116px;
    height: 116px;
  }

  .hero-muffin {
    width: 55px;
    height: 64px;
  }

  .page-hero {
    grid-template-columns: minmax(0, 1fr) 104px;
  }

  .status-grid,
  .countdown-grid,
  .anniversary-composer,
  .nickname-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .route-card {
    grid-template-columns: 52px minmax(0, 1fr) 20px;
    min-height: 106px;
    padding: 15px;
  }

  .route-icon {
    width: 52px;
    height: 52px;
    font-size: 26px;
  }

  .notice-box,
  .order-row {
    grid-template-columns: 1fr;
  }

  .comment-row {
    grid-template-columns: 1fr;
  }
}
