/* LoveUp V3 mobile review prototype. Theme colors are supplied by tokens.json.
   Structure: .app-shell > .app-header + .page-body + .tabbar.
   Use native dialog.showModal(); .sheet / .modal go on #overlay itself. */
:root {
  --font-body: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --font-display: "Noto Serif SC", "Songti SC", SimSun, serif;
  --shell-width: 480px;
  --page-gutter: 20px;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--onSurface);
  background: var(--background);
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
[data-theme="dark"] { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; overflow: hidden; }
body {
  margin: 0;
  min-width: 280px;
  height: 100%;
  color: var(--onSurface);
  background: var(--background);
  font: 400 15px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  overflow: hidden;
}
#app { width: 100%; height: 100%; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button, a { touch-action: manipulation; }
button { color: inherit; }
a { color: var(--primary); text-underline-offset: 3px; }
svg { display: block; width: 22px; height: 22px; flex: 0 0 auto; }
img { display: block; max-width: 100%; object-fit: cover; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select, a, [tabindex] { scroll-margin-block: 24px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
.app-shell {
  width: 100%;
  max-width: var(--shell-width);
  height: 100vh;
  height: 100dvh;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  isolation: isolate;
  overflow: hidden;
  color: var(--onSurface);
  background: var(--background);
}
.app-header {
  flex: 0 0 auto;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--page-gutter) 8px;
  padding-left: max(var(--page-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right, 0px));
  background: var(--background);
  z-index: 5;
}
.brand { font: 400 30px/1.2 Georgia, var(--font-display); letter-spacing: -.04em; color: var(--onSurface); }
.page-title { flex: 1; min-width: 0; font-size: 20px; line-height: 1.4; font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex: 0 0 auto; }
.icon-button {
  display: inline-flex; justify-content: center; align-items: center;
  flex: 0 0 48px; width: 48px; height: 48px;
  border: 0; border-radius: 9px; padding: 12px;
  color: var(--onSurface); background: transparent;
  transition: background-color 100ms ease;
}
.page-body {
  flex: 1 1 auto; min-height: 0; min-width: 0;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior-y: contain; scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
  scroll-padding-block: 20px 28px;
  padding: 16px var(--page-gutter) 28px;
  padding-left: max(var(--page-gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-gutter), env(safe-area-inset-right, 0px));
}
.page-body > * { min-width: 0; }
.tabbar {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px; padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
  min-height: 68px;
  background: var(--surface); border-top: 1px solid var(--outline); z-index: 5;
}
.tab-item {
  min-height: 56px; min-width: 48px; border: 0; padding: 5px 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--onSurfaceVariant); background: transparent;
  text-decoration: none; font-size: 12px; line-height: 18px;
  border-radius: 8px; position: relative;
}
.tab-item[aria-current="page"] { color: var(--primary); font-weight: 600; }
.tab-item[aria-current="page"]::after { content: ""; width: 16px; height: 2px; border-radius: 1px; background: var(--primary); }
.button {
  min-height: 48px; max-width: 100%; padding: 11px 18px;
  border: 1px solid transparent; border-radius: 9px;
  display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  text-align: center; text-decoration: none; font-size: 15px; font-weight: 600; line-height: 24px;
  white-space: normal; overflow-wrap: anywhere;
  color: var(--onPrimary); background: var(--primary);
  transition: background-color 100ms ease, border-color 100ms ease;
}
.button.primary { color: var(--onPrimary); background: var(--primary); }
.button.secondary { color: var(--primary); background: var(--surface); border-color: var(--outline); }
.button.danger { color: var(--error); background: transparent; border-color: transparent; }
.button.text { color: var(--primary); background: transparent; border-color: transparent; font-weight: 400; }
.button:disabled, .button[aria-disabled="true"] {
  color: var(--onSurfaceVariant); background: var(--surfaceVariant); border-color: var(--surfaceVariant);
}
.button[aria-busy="true"] { cursor: progress; }
.field { display: grid; gap: 8px; min-width: 0; margin-block: 0 20px; }
.field label { display: block; font-size: 13px; line-height: 20px; color: var(--onSurface); }
input, textarea, select {
  display: block; width: 100%; min-width: 0; min-height: 50px;
  border: 1px solid var(--outline); border-radius: 9px;
  padding: 12px 14px; color: var(--onSurface); background: var(--surface);
  font-family: var(--font-body); font-size: 16px; line-height: 24px;
  caret-color: var(--primary); transition: border-color 100ms ease;
}
textarea { min-height: 144px; resize: vertical; }
select { padding-right: 36px; }
input::placeholder, textarea::placeholder { color: var(--onSurfaceVariant); opacity: 1; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); }
input[aria-invalid="true"], textarea[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
input:disabled, textarea:disabled, select:disabled { color: var(--onSurfaceVariant); background: var(--surfaceVariant); opacity: 1; }
.field-error, .form-error { color: var(--error); font-size: 13px; line-height: 20px; overflow-wrap: anywhere; }
.helper, .row-meta, .entry-meta { font-size: 13px; line-height: 20px; color: var(--onSurfaceVariant); }
.notice {
  padding: 14px 16px; margin-block: 12px 16px; border-radius: 10px;
  color: var(--onPrimaryContainer); background: var(--primaryContainer);
  font-size: 14px; line-height: 22px; overflow-wrap: anywhere;
}
.notice.error { color: var(--error); background: var(--surface); border: 1px solid var(--error); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; font-size: 18px; line-height: 26px; font-weight: 600; }
.section-heading h2, .section-heading h3 { font: inherit; }
.section-action { display: inline-flex; gap: 6px; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 8px 6px; color: var(--primary); background: transparent; border: 0; border-radius: 8px; font-size: 13px; line-height: 20px; font-weight: 400; text-decoration: none; }
.section-action svg { width: 18px; height: 18px; }
.relationship-ticket { min-height: 168px; padding: 18px; border: 1px solid var(--outline); border-radius: 12px; background: var(--surface); }
.relationship-names { padding-bottom: 16px; border-bottom: 1px dashed var(--outline); font: 400 18px/26px var(--font-display); }
.relationship-days { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; padding-top: 12px; font-size: 14px; color: var(--onSurfaceVariant); }
.relationship-days strong { color: var(--onSurface); font: 400 38px/44px Georgia, var(--font-display); font-variant-numeric: tabular-nums; }
.relationship-ticket .helper { margin-top: 6px; }
.quick-links { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.quick-link { min-width: 0; min-height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 4px 0; border: 0; border-radius: 8px; color: var(--onSurface); background: transparent; font-size: 13px; line-height: 20px; text-decoration: none; }
.quick-link svg { color: var(--primary); }
.list { padding: 0; margin: 0; list-style: none; }
.list-row { width: 100%; min-height: 56px; display: flex; align-items: center; gap: 12px; padding: 12px 0; text-align: left; text-decoration: none; border: 0; border-bottom: 1px solid var(--outline); color: var(--onSurface); background: transparent; }
.list-row:last-child { border-bottom: 0; }
.row-icon { width: 24px; min-width: 24px; display: flex; align-items: center; justify-content: center; color: var(--onSurfaceVariant); }
.row-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row-title { display: block; font-size: 15px; line-height: 24px; font-weight: 500; overflow-wrap: anywhere; }
.row-meta { display: block; margin-top: 4px; }
.row-trailing { flex: 0 0 auto; min-width: 24px; color: var(--onSurfaceVariant); font-size: 13px; }
.check-button { width: 48px; min-width: 48px; height: 48px; display: inline-flex; justify-content: center; align-items: center; padding: 12px; border: 0; border-radius: 8px; color: var(--primary); background: transparent; }
.check-button input[type="checkbox"] { appearance: auto; width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; margin: 0; accent-color: var(--primary); }
.daily-entry { padding: 0 0 20px; margin-bottom: 20px; border-bottom: 1px solid var(--outline); }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; background: var(--surfaceVariant); color: var(--onSurfaceVariant); overflow: hidden; }
.avatar img { width: 100%; height: 100%; }
.entry-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; font-size: 13px; line-height: 20px; color: var(--onSurfaceVariant); }
.entry-body { font-size: 15px; line-height: 25px; white-space: pre-wrap; overflow-wrap: anywhere; }
.entry-meta { margin-top: 12px; }
.segmented { display: flex; gap: 8px; margin-bottom: 24px; }
.segment { flex: 1; min-width: 0; min-height: 48px; padding: 10px 8px; border: 0; border-radius: 8px; color: var(--onSurfaceVariant); background: transparent; font-size: 15px; line-height: 24px; }
.segment[aria-selected="true"] { color: var(--onPrimaryContainer); background: var(--primaryContainer); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 24px; }
.chip { min-height: 48px; padding: 10px 16px; border: 1px solid var(--outline); border-radius: 8px; color: var(--onSurfaceVariant); background: var(--surface); font-size: 13px; line-height: 24px; }
.chip[aria-pressed="true"] { color: var(--onPrimaryContainer); background: var(--primaryContainer); border-color: var(--primaryContainer); }
.mail-row { min-height: 96px; display: flex; align-items: flex-start; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--outline); color: var(--onSurface); background: transparent; text-decoration: none; }
.mail-row .row-icon { margin-top: 3px; }
.mail-row .row-title { font-size: 16px; font-weight: 600; }
.mail-state { flex: 0 0 auto; font-size: 12px; line-height: 20px; color: var(--primary); white-space: normal; max-width: 72px; }
.menu-row { display: flex; align-items: center; gap: 16px; min-height: 96px; padding: 14px 0; border-bottom: 1px solid var(--outline); }
.menu-thumb { width: 56px; height: 56px; flex: 0 0 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 8px; color: var(--onSurfaceVariant); background: var(--surfaceVariant); font-size: 11px; line-height: 16px; overflow: hidden; }
.menu-thumb svg { width: 20px; height: 20px; }
.menu-thumb img { width: 100%; height: 100%; }
.price { display: block; margin-top: 5px; font-size: 15px; line-height: 24px; font-weight: 500; color: var(--onSurface); font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.stepper button { display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px; padding: 12px; border: 1px solid var(--outline); border-radius: 8px; color: var(--primary); background: var(--surface); }
.stepper output { min-width: 20px; text-align: center; }
.profile-identity { display: flex; align-items: center; gap: 16px; min-height: 88px; padding-block: 8px; margin-bottom: 20px; }
.profile-identity .avatar { width: 56px; height: 56px; flex-basis: 56px; }
.profile-identity .row-title { font-size: 22px; line-height: 30px; font-weight: 600; }
.stats-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 28px; }
.stat { min-height: 80px; display: flex; align-items: center; gap: 12px; padding: 16px; border: 0; border-radius: 12px; color: var(--onSurface); background: var(--surface); text-align: left; text-decoration: none; }
.stat svg { color: var(--primary); }
.stat strong { display: block; font-size: 18px; line-height: 26px; font-variant-numeric: tabular-nums; }
.settings-group { padding-inline: 16px; margin-bottom: 28px; background: var(--surface); border-radius: 12px; }
.settings-group .list-row { padding-block: 16px; }
.card { padding: 16px; margin-block: 16px; border-radius: 12px; background: var(--surface); color: var(--onSurface); overflow-wrap: anywhere; }
.card > * + * { margin-top: 12px; }
.media-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-block: 12px; }
.media-grid > * { min-width: 0; aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.media-grid img { width: 100%; height: 100%; }
.media-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; color: var(--onSurfaceVariant); background: var(--surfaceVariant); font-size: 13px; line-height: 20px; text-align: center; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-block: 16px; }
.calendar-day { display: flex; align-items: center; justify-content: center; min-height: 48px; min-width: 0; padding: 4px; border: 1px solid transparent; border-radius: 8px; color: var(--onSurface); background: transparent; font-size: 15px; font-variant-numeric: tabular-nums; }
.calendar-day.today { border-color: var(--primary); font-weight: 600; }
.calendar-day.selected { color: var(--onPrimary); background: var(--primary); }
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.form-actions .button { flex: 1 1 140px; }
.form-footer { margin-top: 24px; text-align: center; font-size: 13px; line-height: 20px; color: var(--onSurfaceVariant); }
.auth-page { max-width: 390px; margin-inline: auto; padding: clamp(16px, 4dvh, 32px) 4px 32px; }
.auth-brand { margin: 0 0 28px; color: var(--primary); font: 400 32px/40px Georgia, var(--font-display); letter-spacing: -.04em; }
.auth-title { font-size: 24px; line-height: 32px; font-weight: 600; margin-bottom: 10px; }
.auth-subtitle { margin-bottom: 28px; font-size: 14px; line-height: 22px; color: var(--onSurfaceVariant); }
.auth-page form > .button { width: 100%; }
.auth-links { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 16px; margin-top: 20px; }
.auth-links a, .auth-links button { display: inline-flex; align-items: center; min-height: 48px; padding: 8px 0; border: 0; background: transparent; color: var(--primary); font-size: 13px; line-height: 20px; }
.form-error { padding: 12px 14px; margin-bottom: 20px; border: 1px solid var(--error); border-radius: 9px; background: var(--surface); }
.password-wrap { position: relative; min-width: 0; }
.password-wrap input { padding-right: 58px; }
.password-toggle { position: absolute; top: 1px; right: 1px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 8px; padding: 12px; background: transparent; color: var(--onSurfaceVariant); }
.spinner { display: inline-block; flex: 0 0 auto; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: loveup-spin 800ms linear infinite; }
@keyframes loveup-spin { to { transform: rotate(360deg); } }
#overlay { padding: 0; border: 0; color: var(--onSurface); background: var(--surface); overflow: hidden; }
#overlay:not([open]) { display: none; }
#overlay[open] { display: flex; flex-direction: column; max-height: 90vh; max-height: 90dvh; overscroll-behavior: contain; }
#overlay[open].modal { width: 342px; max-width: calc(100% - 32px); margin: auto; border-radius: 16px; }
#overlay[open].sheet { width: 100%; max-width: var(--shell-width); margin: auto auto 0; border-radius: 20px 20px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
#overlay::backdrop { background: color-mix(in srgb, var(--onSurface) 35%, transparent); }
.dialog-title { margin: 0; padding: 22px 64px 20px 20px; min-height: 64px; font-size: 20px; line-height: 28px; font-weight: 600; }
.dialog-close { position: absolute; top: 10px; right: 8px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; padding: 12px; border: 0; border-radius: 9px; background: transparent; color: var(--onSurfaceVariant); }
.dialog-body { flex: 1 1 auto; min-height: 0; padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior-y: contain; scroll-padding-block: 16px 24px; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; padding: 0 20px 20px; flex: 0 0 auto; background: var(--surface); }
.dialog-actions .button { flex: 1 1 130px; }
.dialog-form { display: flex; flex-direction: column; min-height: 0; max-height: inherit; overflow-y: auto; scroll-padding-block: 16px 24px; }
.dialog-form .dialog-body { overflow: visible; }
.dialog-form .dialog-actions { position: sticky; bottom: 0; padding-top: 12px; }
.toast[role="status"] { position: fixed; z-index: 50; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); width: max-content; max-width: min(448px, calc(100% - 32px)); padding: 12px 16px; border-radius: 10px; background: var(--onSurface); color: var(--surface); font-size: 13px; line-height: 20px; text-align: center; overflow-wrap: anywhere; pointer-events: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (hover: hover) {
  .icon-button:hover, .password-toggle:hover, .dialog-close:hover, .quick-link:hover, .tab-item:hover { background: var(--surfaceVariant); }
  .button.primary:not(:disabled):not([aria-disabled="true"]):hover, .button:not(.secondary):not(.text):not(.danger):not(:disabled):not([aria-disabled="true"]):hover { background: color-mix(in srgb, var(--primary) 90%, var(--onSurface)); }
  .button.secondary:hover, .button.text:hover, .section-action:hover { background: var(--surfaceVariant); }
}
.button:active:not(:disabled), .icon-button:active, .password-toggle:active, .dialog-close:active, .quick-link:active, .section-action:active, .tab-item:active, .chip:active, .segment:active { background: var(--surfaceVariant); color: var(--onSurface); }
.button.primary:active:not(:disabled), .button:not(.secondary):not(.text):not(.danger):active:not(:disabled) { background: color-mix(in srgb, var(--primary) 84%, var(--onSurface)); color: var(--onPrimary); }
.button.danger:active { color: var(--error); }
@media (min-width: 600px) {
  body { background: color-mix(in srgb, var(--background) 86%, var(--onSurface)); }
  .app-shell { box-shadow: 0 0 36px color-mix(in srgb, var(--onSurface) 10%, transparent); }
}
@media (max-width: 359px) {
  :root { --page-gutter: 16px; }
  .auth-page { padding-inline: 0; }
  .quick-links { gap: 4px; }
  .quick-link { font-size: 12px; }
  .stats-row { gap: 8px; }
  .stat { padding: 12px; gap: 8px; }
  .menu-row { gap: 12px; }
  .stepper { gap: 4px; }
  .form-actions .button { flex-basis: 100%; }
  .dialog-actions .button { flex-basis: 100%; }
}
@media (max-height: 560px) {
  .auth-page { padding-top: 8px; }
  .auth-brand { margin-bottom: 16px; }
  .dialog-title { padding-top: 16px; padding-bottom: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0ms !important; animation: none !important; }
  .spinner { animation: none; }
}
@media (forced-colors: active) {
  .button, input, textarea, select, .chip, .segment, .calendar-day, .relationship-ticket { border: 1px solid; }
  .tab-item[aria-current="page"], .segment[aria-selected="true"], .chip[aria-pressed="true"] { text-decoration: underline; }
}
