:root {
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", Georgia, serif;
  color: #3a2028;
  background: #f8efed;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --rose: #bb4167;
  --rose-dark: #8d294d;
  --rose-soft: #f7dfe4;
  --wine: #542435;
  --gold: #c8954d;
  --ink: #3a2028;
  --muted: #89747a;
  --line: #eadad6;
  --shadow: 0 12px 32px rgba(104, 55, 61, .10), 0 2px 8px rgba(80, 42, 47, .05);
}
* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { min-width: 320px; background: #f7efed; }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.page-background {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(280px, 430px) minmax(360px, 470px);
  justify-content: center;
  align-items: center;
  gap: clamp(28px, 6vw, 90px);
  padding: 28px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 14% 14%, rgba(255,255,255,.98), rgba(255,255,255,0) 31%),
    radial-gradient(circle at 86% 85%, rgba(237,199,200,.45), rgba(255,255,255,0) 28%),
    linear-gradient(135deg, #f9f2f0 0%, #fffaf8 46%, #f3e3df 100%);
}
.page-background::before,
.page-background::after {
  content: "";
  position: absolute;
  width: 520px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(90deg, rgba(193,99,119,.12), rgba(255,255,255,.8), rgba(193,99,119,.18));
  filter: blur(2px);
  transform: rotate(-22deg);
  pointer-events: none;
}
.page-background::before { top: 18px; left: -165px; }
.page-background::after { right: -165px; bottom: 20px; transform: rotate(22deg); }

.desktop-brand { position: relative; z-index: 1; max-width: 430px; }
.desktop-brand .mini-crown { color: var(--gold); display: block; margin-bottom: 10px; }
.script-logo { font-family: "Snell Roundhand", "Segoe Script", cursive; font-size: clamp(46px, 6vw, 76px); line-height: .85; color: var(--gold); font-style: italic; }
.desktop-brand h2 { font-size: clamp(29px, 3.6vw, 48px); line-height: 1.55; letter-spacing: .08em; font-weight: 500; margin: 30px 0 14px; color: var(--wine); }
.desktop-brand p { color: #9a6574; letter-spacing: .13em; line-height: 1.9; }

.app-shell {
  width: 100%;
  max-width: 460px;
  height: min(900px, calc(100vh - 56px));
  min-height: 660px;
  position: relative;
  z-index: 2;
  overflow: hidden;
  border-radius: 42px;
  border: 1px solid rgba(196,148,91,.6);
  background:
    radial-gradient(circle at 96% 2%, rgba(245,216,218,.55), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,249,247,.98));
  box-shadow: 0 38px 80px rgba(89, 45, 51, .2), inset 0 0 0 7px rgba(255,255,255,.55);
}
.app-shell::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 35px;
  border: 1px solid rgba(176,123,61,.3);
  pointer-events: none;
  z-index: 20;
}

.app-header {
  position: absolute;
  z-index: 12;
  inset: 0 0 auto;
  height: 92px;
  padding: 24px 20px 10px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  background: linear-gradient(180deg, rgba(255,250,248,.98), rgba(255,250,248,.88), rgba(255,250,248,0));
}
.icon-button, .header-help {
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--wine);
}
.icon-button { cursor: pointer; }
.icon-button:hover { background: rgba(187,65,103,.07); }
.header-title-wrap { text-align: center; display: grid; place-items: center; color: var(--wine); }
.header-title-wrap h1 { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: .08em; line-height: 1.2; }
.header-title-wrap > svg { color: var(--gold); margin-bottom: -2px; }
.title-ornament { width: 72px; height: 8px; display: block; position: relative; margin-top: 3px; background: radial-gradient(circle, var(--gold) 0 2px, transparent 2.5px) center / 8px 8px no-repeat; }
.title-ornament::before, .title-ornament::after { content: ""; position: absolute; top: 4px; width: 30px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.title-ornament::before { left: 0; }
.title-ornament::after { right: 0; transform: scaleX(-1); }

.screen {
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none;
  padding: 94px 22px 104px;
}
.screen::-webkit-scrollbar { display: none; }

.bottom-nav {
  position: absolute;
  z-index: 15;
  left: 9px;
  right: 9px;
  bottom: 9px;
  height: 86px;
  padding: 11px 13px 13px;
  border-radius: 0 0 34px 34px;
  background: rgba(255,252,250,.96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 24px rgba(82,41,48,.05);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
.bottom-nav button {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #8c7b7e;
  font-size: 10px;
  cursor: pointer;
  border-radius: 16px;
}
.bottom-nav button.active { color: var(--rose); background: linear-gradient(180deg, rgba(187,65,103,.08), transparent); }
.bottom-nav button span { letter-spacing: .08em; }

.summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.summary-card {
  min-height: 120px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(255,248,245,.9));
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.summary-card::after { content: ""; position: absolute; inset: auto -28px -45px auto; width: 90px; height: 90px; border-radius: 50%; background: rgba(230,190,187,.1); }
.summary-card svg { color: var(--gold); }
.summary-card span { font-size: 12px; color: #6e5960; letter-spacing: .06em; }
.summary-card strong { font-size: clamp(17px, 4.4vw, 22px); font-weight: 500; white-space: nowrap; }
.summary-card.accent strong { color: var(--rose); }

.panel {
  position: relative;
  background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(255,248,246,.88));
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}
.month-summary { margin-top: 14px; overflow: hidden; padding: 16px 17px 12px; }
.panel-heading.centered { text-align: center; position: relative; z-index: 1; }
.panel-heading span { display: block; color: #755762; font-size: 13px; letter-spacing: .08em; }
.panel-heading strong { display: block; margin-top: 3px; font-weight: 500; font-size: 15px; }
.panel-flower { position: absolute; right: -24px; bottom: -25px; opacity: .12; width: 145px; }
.floral-mark { fill: rgba(208,127,145,.28); stroke: #c98c93; stroke-width: 1.4; }
.summary-list { margin: 10px 0 0; position: relative; z-index: 1; }
.summary-list > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 2px; border-top: 1px dashed #ead9d5; font-size: 12px; }
.summary-list dt { color: #755f65; }
.summary-list dd { margin: 0; font-weight: 600; }
.summary-list .profit-row { color: var(--rose); font-size: 13px; }
.summary-list > div:last-child { font-size: 11px; }

.primary-button {
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(145deg, #ca5277, #942d51);
  box-shadow: 0 10px 24px rgba(157,46,79,.28), inset 0 1px rgba(255,255,255,.34);
  font-weight: 600;
  letter-spacing: .08em;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.primary-button:hover { filter: brightness(1.03); transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }
.add-record-button { width: 100%; min-height: 55px; margin-top: 15px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.round-plus { width: 25px; height: 25px; border: 1px solid rgba(255,255,255,.8); border-radius: 50%; display: grid; place-items: center; }
.text-link { width: 100%; border: 0; background: transparent; color: var(--rose-dark); padding: 12px; cursor: pointer; font-size: 12px; }

.modal-backdrop { position: absolute; z-index: 50; inset: 0; background: rgba(56,25,34,.34); backdrop-filter: blur(3px); display: flex; align-items: flex-end; }
.bottom-sheet { width: 100%; padding: 10px 22px 33px; background: #fffaf8; border-radius: 30px 30px 0 0; box-shadow: 0 -20px 55px rgba(60,26,37,.25); animation: sheetUp .26s ease-out; }
@keyframes sheetUp { from { transform: translateY(100%); } }
.sheet-handle { width: 42px; height: 5px; border-radius: 99px; background: #dcc9c5; margin: 0 auto 18px; }
.sheet-title-row { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.eyebrow { display: block; color: var(--gold); text-transform: uppercase; letter-spacing: .18em; font-size: 10px; font-weight: 700; }
.sheet-title-row h2, .section-intro h2 { margin: 4px 0 0; font-size: 21px; font-weight: 600; }
.choice-card { width: 100%; border: 1px solid var(--line); background: rgba(255,255,255,.9); border-radius: 18px; padding: 16px; margin-top: 10px; display: grid; grid-template-columns: 48px 1fr 24px; align-items: center; gap: 12px; text-align: left; cursor: pointer; }
.choice-card:hover { border-color: #d6b2b7; box-shadow: var(--shadow); }
.choice-icon { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; color: var(--gold); background: #fff6f1; }
.income-choice .choice-icon { color: var(--rose); background: var(--rose-soft); }
.choice-card strong { display: block; font-size: 16px; }
.choice-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.choice-card > svg { color: #a58f94; }

.form-screen { padding-bottom: 42px; }
.field-label { display: block; margin: 18px 0 9px; font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.input, .money-input, .textarea {
  width: 100%;
  border: 1px solid #e7d8d4;
  background: rgba(255,255,255,.82);
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(82,48,52,.03), 0 5px 13px rgba(80,42,47,.04);
}
.input { min-height: 48px; padding: 0 14px; color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chips button { min-height: 42px; border-radius: 23px; padding: 0 16px; border: 1px solid #e5d6d3; background: rgba(255,255,255,.9); box-shadow: 0 5px 12px rgba(78,43,49,.06); cursor: pointer; font-size: 12px; }
.chips button.selected { color: #fff; border-color: transparent; background: linear-gradient(145deg, #c95a7a, #9a3155); box-shadow: 0 8px 15px rgba(157,47,80,.2); }
.time-chips button { flex: 1 1 65px; padding-inline: 10px; }
.money-input { min-height: 54px; display: flex; align-items: center; padding: 0 14px; gap: 9px; }
.money-input span { font-size: 18px; }
.money-input input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 18px; }
.money-input.large { min-height: 65px; }
.money-input.large input { font-size: 25px; }
.option-list { border: 1px solid #e7d8d4; border-radius: 15px; overflow: hidden; background: rgba(255,255,255,.78); }
.option-row { min-height: 49px; display: grid; grid-template-columns: minmax(0, 1fr) 104px 34px; align-items: center; border-bottom: 1px solid #ede0dc; padding: 4px 6px 4px 12px; }
.option-row input { border: 0; outline: 0; min-width: 0; width: 100%; background: transparent; font-size: 12px; }
.option-money { display: flex; gap: 4px; align-items: center; }
.option-money input { text-align: right; }
.remove-button { border: 0; background: transparent; color: var(--rose-dark); display: grid; place-items: center; cursor: pointer; }
.add-option-button { width: 100%; min-height: 45px; border: 0; background: transparent; color: var(--wine); display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; font-size: 12px; }
.textarea { min-height: 100px; resize: vertical; padding: 14px; outline: 0; color: var(--ink); }
.textarea.large { min-height: 145px; }
.total-card { min-height: 92px; margin-top: 19px; padding: 12px; border-radius: 16px; border: 1px solid #edcfce; background: linear-gradient(145deg, #fff9f7, #fbedeb); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.total-card span { font-size: 14px; }
.total-card strong { color: var(--rose); font-weight: 500; font-size: 30px; margin-top: 4px; }
.save-button { width: 100%; min-height: 58px; margin-top: 16px; font-size: 16px; }
.expense-form { padding-top: 100px; }
.expense-total { min-height: 112px; align-items: flex-start; padding-left: 21px; }
.total-flower { position: absolute; width: 135px; right: -7px; bottom: -12px; opacity: .38; }

.section-intro { display: flex; align-items: end; justify-content: space-between; margin: 4px 2px 15px; }
.mini-add { border: 1px solid #e6d4d1; background: #fff; border-radius: 20px; min-height: 37px; padding: 0 13px; display: flex; align-items: center; gap: 5px; color: var(--rose-dark); cursor: pointer; }
.record-day { margin-bottom: 13px; overflow: hidden; }
.record-day-header { width: 100%; border: 0; background: linear-gradient(90deg, rgba(250,226,229,.65), rgba(255,255,255,.75)); padding: 13px 15px; display: flex; justify-content: space-between; align-items: center; text-align: left; cursor: pointer; }
.record-day-header strong { display: block; font-size: 13px; }
.record-day-header small { display: block; margin-top: 4px; color: var(--rose); }
.entry-list { padding: 3px 13px 8px; }
.entry-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 30px; align-items: center; gap: 9px; min-height: 62px; border-bottom: 1px dashed #eadbd8; }
.entry-item:last-child { border-bottom: 0; }
.entry-badge { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; background: #f4eee9; color: var(--gold); }
.entry-badge.income { color: var(--rose); background: #f9e5e9; }
.entry-main { min-width: 0; }
.entry-main strong { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-main small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry-amount { font-size: 12px; }
.entry-amount.income { color: var(--rose); }
.entry-delete { border: 0; background: transparent; color: #aa9699; display: grid; place-items: center; cursor: pointer; }
.empty-state { text-align: center; padding: 35px 18px; color: var(--muted); }
.empty-state .empty-icon { width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: #f9e9e9; color: var(--rose); display: grid; place-items: center; }
.empty-state strong { display: block; color: var(--wine); }
.empty-state p { margin: 7px auto 0; max-width: 260px; font-size: 12px; line-height: 1.7; }

.calendar-switcher, .date-switcher { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 14px; }
.calendar-switcher button, .date-switcher button { border: 0; background: transparent; color: var(--rose); display: grid; place-items: center; cursor: pointer; }
.calendar-switcher strong { text-align: center; font-weight: 500; font-size: 17px; }
.calendar-card { padding: 15px 12px 13px; }
.week-row, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.week-row span { text-align: center; color: #a6878d; font-size: 10px; padding: 5px 0 10px; }
.week-row span:first-child { color: #c85b73; }
.calendar-day { border: 0; background: transparent; min-height: 49px; border-radius: 13px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: default; font-size: 12px; }
.calendar-day.has-data { cursor: pointer; background: linear-gradient(145deg, #fbe9eb, #fff8f5); color: var(--rose-dark); }
.calendar-day.today { box-shadow: inset 0 0 0 1px var(--gold); }
.calendar-day small { font-size: 8px; color: var(--rose); }
.calendar-summary { margin-top: 14px; padding: 8px 16px; }
.calendar-summary > div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed #eadbd7; font-size: 12px; }
.calendar-summary > div:last-child { border-bottom: 0; }
.calendar-summary strong { font-size: 14px; }
.calendar-summary .calendar-profit { color: var(--rose); }

.date-switcher { border: 1px solid var(--line); border-radius: 26px; min-height: 46px; background: rgba(255,255,255,.78); }
.date-switcher label { position: relative; text-align: center; cursor: pointer; }
.date-switcher input { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.date-switcher span { font-size: 12px; font-weight: 600; }
.result-card { padding: 13px 15px; }
.result-row { display: flex; justify-content: space-between; padding: 9px 2px; font-size: 13px; }
.result-row .rose { color: var(--rose); }
.net-profit { min-height: 100px; margin-top: 3px; border: 1px solid #edcecf; border-radius: 16px; background: linear-gradient(145deg, #fffafa, #f9e9e8); display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--rose); }
.net-profit svg { color: var(--gold); }
.net-profit span { font-size: 16px; }
.net-profit strong { font-size: 31px; font-weight: 500; margin-top: 4px; }
.breakdown, .chart-panel { margin-top: 13px; padding: 15px; }
.breakdown h2, .chart-panel h2, .settings-panel h2 { margin: 0 0 10px; font-size: 13px; }
.breakdown dl { margin: 0; }
.breakdown dl > div { display: flex; justify-content: space-between; padding: 6px 0; font-size: 11px; }
.breakdown dd { margin: 0; }
.breakdown .expense-line { color: #7f7476; }
.trend-chart { width: 100%; }
.trend-chart svg { width: 100%; overflow: visible; }
.grid-line { stroke: #eadfdd; stroke-width: 1; stroke-dasharray: 3 4; }
.trend-line { fill: none; stroke: var(--rose); stroke-width: 2.4; }
.trend-chart circle { fill: #fff; stroke: var(--rose); stroke-width: 2; }
.trend-chart circle.last-point { fill: var(--rose); stroke-width: 4; }
.trend-chart text { fill: #9f8d91; font-size: 8px; }
.encouragement { min-height: 68px; margin-top: 13px; border: 1px solid #edcfce; border-radius: 16px; background: linear-gradient(145deg, #fff9f5, #f9e5e4); display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); }
.encouragement span { color: var(--wine); }
.encouragement strong, .encouragement small { display: block; }
.encouragement strong { font-size: 12px; }
.encouragement small { margin-top: 4px; color: #8c7479; font-size: 9px; }

.profile-hero { padding: 27px 18px 22px; text-align: center; overflow: hidden; }
.profile-hero::after { content: ""; position: absolute; width: 170px; height: 170px; border-radius: 50%; right: -70px; top: -75px; background: rgba(236,195,197,.22); }
.profile-emblem { width: 66px; height: 66px; margin: 0 auto 16px; border-radius: 50%; display: grid; place-items: center; color: var(--gold); background: linear-gradient(145deg, #fff, #f9e9e5); border: 1px solid #e8d1c9; box-shadow: var(--shadow); }
.profile-hero .script-logo { font-size: 42px; }
.profile-hero h2 { margin: 13px 0 5px; font-size: 18px; }
.profile-hero p { margin: 0; color: #9b7780; font-size: 11px; letter-spacing: .06em; }
.settings-panel { margin-top: 14px; padding: 15px 14px 6px; }
.settings-panel > button { width: 100%; min-height: 67px; padding: 9px 3px; border: 0; border-bottom: 1px solid #ecdfdc; background: transparent; display: grid; grid-template-columns: 42px 1fr 22px; align-items: center; gap: 10px; text-align: left; cursor: pointer; }
.settings-panel > button:last-of-type { border-bottom: 0; }
.setting-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; color: var(--rose); background: #fae9eb; }
.settings-panel button span:nth-child(2) strong, .settings-panel button span:nth-child(2) small { display: block; }
.settings-panel button span:nth-child(2) strong { font-size: 12px; }
.settings-panel button span:nth-child(2) small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.settings-panel button > svg { color: #ad989c; }
.settings-panel .danger-setting { color: #9a314c; }
.settings-panel .danger-setting .setting-icon { color: #9a314c; background: #f7e6e7; }
.about-card { margin-top: 14px; padding: 15px; display: flex; gap: 12px; color: var(--gold); }
.about-card div { color: var(--ink); }
.about-card strong { font-size: 12px; }
.about-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.7; }
.version { text-align: center; color: #ad989c; font-size: 9px; margin: 16px 0; }

.toast { position: absolute; z-index: 100; left: 50%; bottom: 105px; transform: translateX(-50%); padding: 10px 16px; border-radius: 99px; color: #fff; background: rgba(71,37,47,.92); box-shadow: 0 10px 24px rgba(45,20,27,.22); display: flex; align-items: center; gap: 7px; white-space: nowrap; font-size: 12px; animation: toastIn .2s ease-out; }
@keyframes toastIn { from { transform: translate(-50%, 10px); opacity: 0; } }

.desktop-flower { position: absolute; width: 210px; opacity: .13; pointer-events: none; }
.flower-one { left: -22px; bottom: -12px; transform: rotate(-15deg); }
.flower-two { right: -35px; top: 18px; transform: rotate(180deg); }

@media (max-width: 900px) {
  .page-background { display: block; padding: 0; background: #fff9f7; }
  .desktop-brand, .desktop-flower { display: none; }
  .app-shell { max-width: none; width: 100%; height: 100vh; min-height: 600px; border: 0; border-radius: 0; box-shadow: none; }
  .app-shell::before { display: none; }
  .bottom-nav { left: 0; right: 0; bottom: 0; border-radius: 0; }
}
@media (max-width: 390px) {
  .screen { padding-inline: 16px; }
  .summary-card { min-height: 108px; }
  .summary-card strong { font-size: 17px; }
  .option-row { grid-template-columns: minmax(0, 1fr) 88px 30px; }
  .chips { gap: 7px; }
  .chips button { padding-inline: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
