:root {
  --paper: #e9eddf;
  --paper-deep: #dbe2cd;
  --card: #fbfcf5;
  --ink: #173a30;
  --muted: #64756a;
  --line: #aabbac;
  --accent: #df693f;
  --accent-soft: #f5d8c9;
  --yellow: #f2c14e;
  --green: #286a55;
  --shadow: 0 24px 60px rgba(28, 66, 52, .10);
  --radius: 24px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-display: "Songti SC", "Noto Serif CJK SC", "STSong", serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Roboto Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 80% 8%, rgba(242, 193, 78, .20), transparent 23%),
    linear-gradient(180deg, #edf0e5 0, #e9eddf 52%, #e3e8d8 100%);
  font-family: var(--font-sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .32; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Ccircle cx='1' cy='1' r='.7' fill='%23173a30'/%3E%3C/svg%3E");
}
button, input, textarea, select { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
canvas, svg { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 16px; color: white; background: var(--ink); border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 16px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.shell { width: min(1160px, calc(100% - 40px)); margin-inline: auto; }

.site-header { padding: 22px 0; border-bottom: 1px solid rgba(23, 58, 48, .16); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; color: var(--card); background: var(--ink); border-radius: 50% 50% 50% 12px; font-family: var(--font-display); font-size: 21px; }
.brand-copy { display: grid; line-height: 1.15; }
.brand-copy strong { font-family: var(--font-display); font-size: 20px; letter-spacing: .1em; }
.brand-copy small { margin-top: 4px; color: var(--muted); font-family: var(--font-mono); font-size: 9px; letter-spacing: .11em; }
.top-nav { display: flex; gap: 26px; font-size: 13px; }
.top-nav a { text-decoration: none; border-bottom: 1px solid transparent; }
.top-nav a:hover { border-color: var(--accent); }

.hero { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .55fr); align-items: center; gap: clamp(40px, 8vw, 104px); padding-block: clamp(54px, 8vw, 98px) 70px; }
.eyebrow { display: flex; align-items: center; gap: 11px; margin: 0 0 23px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.eyebrow span { padding: 4px 8px; color: var(--card); background: var(--green); border-radius: 40px; font-family: var(--font-mono); font-size: 9px; }
.hero h1 { margin: 0; font-family: var(--font-display); font-size: clamp(55px, 8vw, 98px); line-height: 1.02; letter-spacing: -.06em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero-copy > p:last-child { max-width: 620px; margin: 28px 0 0; color: #4e665b; font-size: clamp(15px, 1.7vw, 18px); line-height: 1.9; }

.today-board {
  position: relative; min-height: 330px; padding: 38px; overflow: hidden; color: var(--card);
  background: var(--ink); border-radius: 50% 50% 38% 38% / 42% 42% 34% 34%;
  box-shadow: 14px 18px 0 var(--yellow); text-align: center; isolation: isolate;
}
.today-board::before { content: ""; position: absolute; inset: 14px; z-index: -1; border: 1px solid rgba(251, 252, 245, .2); border-radius: inherit; }
.today-ring { position: absolute; top: 16px; left: 50%; width: 8px; height: 20px; background: var(--yellow); transform: translateX(-50%); border-radius: 10px; }
.today-board > p { margin: 32px 0 2px; color: #b5c6bb; font-size: 12px; letter-spacing: .25em; }
.today-board > strong { display: block; font-family: var(--font-display); font-size: 122px; font-weight: 500; line-height: 1; letter-spacing: -.09em; }
.today-board > div { display: flex; justify-content: center; gap: 9px; color: #d5dfd8; font-size: 12px; }
.today-board > div span + span::before { content: "·"; margin-right: 9px; color: var(--yellow); }
.today-board small { display: block; max-width: 220px; margin: 25px auto 0; color: #8ea398; font-size: 10px; line-height: 1.6; }

.calculator { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 26px; align-items: start; }
.mode-rail { position: sticky; top: 22px; min-width: 0; padding: 24px; color: var(--card); background: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
.rail-title { margin: 0 0 16px; color: #9fb3a7; font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; }
.mode-list { display: grid; gap: 7px; }
.mode-button { display: grid; grid-template-columns: 26px 1fr; grid-template-rows: auto auto; column-gap: 7px; width: 100%; padding: 12px 12px; text-align: left; color: #b9c7be; background: transparent; border: 1px solid transparent; border-radius: 12px; cursor: pointer; }
.mode-button > span { grid-row: 1 / 3; align-self: center; color: #6d8a79; font-family: var(--font-mono); font-size: 9px; }
.mode-button strong { color: inherit; font-size: 13px; font-weight: 650; }
.mode-button small { color: #738b7e; font-size: 9px; }
.mode-button:hover { background: #1f493c; }
.mode-button.is-active { color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.mode-button.is-active > span, .mode-button.is-active small { color: #5c6b38; }
.rail-note { display: flex; gap: 10px; margin-top: 21px; padding-top: 17px; border-top: 1px solid #375a4d; color: #8da398; }
.rail-note span { color: var(--accent); font-size: 22px; line-height: 1; }
.rail-note p { margin: 0; font-size: 9.5px; line-height: 1.65; }

.tool-stage { min-width: 0; }
.tool-panel { padding: clamp(25px, 4vw, 44px); background: var(--card); border: 1px solid rgba(23, 58, 48, .12); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 24px; border-bottom: 1px solid #dfe5d8; }
.panel-heading h2 { margin: 3px 0 6px; font-family: var(--font-display); font-size: clamp(27px, 3vw, 38px); line-height: 1.22; letter-spacing: -.04em; }
.panel-heading p:not(.section-index) { margin: 0; color: var(--muted); font-size: 12px; }
.section-index { margin: 0 0 2px; color: var(--accent); font-family: var(--font-mono); font-size: 9px; letter-spacing: .15em; }
.mode-stamp { display: grid; place-items: center; flex: 0 0 auto; width: 54px; height: 54px; color: var(--accent); border: 1px solid #d7a48e; border-radius: 50%; font-family: var(--font-display); font-size: 24px; transform: rotate(8deg); }
.calculator-form { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 24px 0; }
.date-field { display: grid; flex: 1 1 180px; gap: 7px; }
.date-field > span { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .05em; }
.wide-field { flex-basis: 100%; }
input[type="date"], input[type="time"], input[type="number"], input[type="text"] {
  width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); background: #f5f7ee; border: 1px solid #bcc9b8; border-radius: 10px; outline: 0;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(40, 106, 85, .13); }
input:disabled { color: #87958b; background: #e7ebdf; cursor: not-allowed; }
.date-arrow { align-self: center; margin-top: 12px; color: var(--accent); font-size: 18px; }
.premium-check { display: flex; flex-basis: 100%; align-items: center; gap: 8px; color: #435d51; font-size: 12px; }
.premium-check input { width: 17px; height: 17px; accent-color: var(--green); }
.premium-tag { display: inline-flex; align-items: center; padding: 1px 5px; color: var(--card); background: var(--accent); border-radius: 4px; font-family: var(--font-mono); font-size: 8px; font-style: normal; font-weight: 500; vertical-align: middle; }
.calculate-button, .save-button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 45px; padding: 10px 18px; color: var(--card); background: var(--green); border: 1px solid var(--green); border-radius: 10px; font-size: 12px; font-weight: 700; cursor: pointer; transition: transform .15s, background .15s; }
.calculate-button:hover, .save-button:hover:not(:disabled) { background: var(--ink); transform: translateY(-1px); }
.calculate-button span { color: var(--yellow); }
.quick-row { display: flex; flex-basis: 100%; flex-wrap: wrap; gap: 7px; }
.quick-row button { padding: 5px 10px; color: #4f675c; background: #f0f3e7; border: 1px solid #c9d3c4; border-radius: 30px; font-size: 10px; cursor: pointer; }
.quick-row button:hover { color: var(--card); background: var(--green); border-color: var(--green); }

.result-sheet, .countdown-sheet, .weekday-sheet { position: relative; padding: 24px; overflow: hidden; background: #eef2e5; border-radius: 16px; }
.result-sheet::after { content: ""; position: absolute; right: -30px; bottom: -50px; width: 150px; height: 150px; border: 22px solid rgba(23, 58, 48, .05); border-radius: 50%; pointer-events: none; }
.result-label { margin: 0 0 3px; color: var(--muted); font-size: 10px; }
.result-hero { display: flex; align-items: baseline; gap: 7px; }
.result-hero strong { font-family: var(--font-display); font-size: clamp(64px, 10vw, 106px); font-weight: 500; line-height: 1; letter-spacing: -.07em; }
.result-hero span { color: var(--accent); font-family: var(--font-display); font-size: 25px; }
.result-summary { margin: 9px 0 17px; color: #4c665a; font-size: 12px; }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; background: #ced8c8; border: 1px solid #ced8c8; border-radius: 11px; }
.result-grid > div { min-width: 0; padding: 13px; background: var(--card); }
.result-grid span { display: block; color: var(--muted); font-size: 9px; }
.result-grid strong { display: block; margin-top: 3px; font-size: 14px; overflow-wrap: anywhere; }
.result-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 17px; }
.text-export { padding: 0; color: var(--green); background: transparent; border: 0; border-bottom: 1px solid currentColor; font-size: 10px; cursor: pointer; }
.text-export:disabled { color: #94a199; border-color: transparent; cursor: not-allowed; }
.result-tip { color: #839287; font-size: 9px; }
.date-result-big { font-family: var(--font-display); font-size: clamp(35px, 5vw, 59px); line-height: 1.15; letter-spacing: -.05em; }
.weekday-result { margin: 2px 0; color: var(--accent); font-size: 15px; font-weight: 700; }
.age-layout { display: flex; align-items: flex-end; gap: 30px; }
.age-main { display: flex; align-items: baseline; gap: 7px; }
.age-main strong { font-family: var(--font-display); font-size: clamp(80px, 11vw, 116px); font-weight: 500; line-height: .85; letter-spacing: -.08em; }
.age-main span { color: var(--accent); font-family: var(--font-display); font-size: 23px; }
.age-detail { display: flex; gap: 16px; padding-bottom: 6px; }
.age-detail div { display: grid; }
.age-detail strong { font-family: var(--font-display); font-size: 27px; font-weight: 500; line-height: 1; }
.age-detail span { color: var(--muted); font-size: 9px; }

.countdown-sheet { text-align: center; background: var(--ink); color: var(--card); }
.countdown-sheet::after { border-color: rgba(242, 193, 78, .08); }
.countdown-sheet .result-label { color: #a3b7ab; font-size: 11px; letter-spacing: .08em; }
.countdown-clock { display: flex; align-items: flex-start; justify-content: center; gap: clamp(5px, 1.5vw, 14px); margin: 12px 0 0; }
.countdown-clock div { display: grid; min-width: 64px; }
.countdown-clock strong { font-family: var(--font-mono); font-size: clamp(38px, 6vw, 65px); font-weight: 500; line-height: 1.15; letter-spacing: -.06em; }
.countdown-clock span { color: #8ea499; font-size: 9px; }
.countdown-clock i { padding-top: 10px; color: var(--accent); font-family: var(--font-mono); font-size: 27px; font-style: normal; opacity: .7; }
.countdown-sheet .result-summary { color: #aec0b5; }
.countdown-actions { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 11px; }
.save-button { min-height: 38px; padding: 7px 13px; color: var(--ink); background: var(--yellow); border-color: var(--yellow); }
.save-button:disabled { opacity: .45; cursor: not-allowed; }
.countdown-sheet .text-export { color: #c9d6ce; }
.saved-section { margin-top: 22px; }
.saved-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 9px; border-bottom: 1px solid #dfe5d8; }
.saved-heading h3 { margin: 0; font-size: 14px; }
.saved-heading span { color: var(--muted); font-family: var(--font-mono); font-size: 9px; }
.saved-list { display: grid; gap: 8px; margin-top: 10px; }
.saved-empty { margin: 8px 0; color: #87968d; font-size: 11px; }
.saved-item { display: flex; align-items: stretch; border: 1px solid #d4dccf; border-radius: 10px; background: #f6f8f0; }
.saved-main { flex: 1; display: grid; grid-template-columns: 1fr auto; gap: 1px 12px; padding: 10px 12px; text-align: left; border: 0; background: transparent; cursor: pointer; }
.saved-main strong { font-size: 12px; }
.saved-main span { grid-column: 1; color: var(--muted); font-family: var(--font-mono); font-size: 8.5px; }
.saved-main small { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--accent); font-size: 10px; white-space: nowrap; }
.saved-delete { padding: 0 11px; color: #8b6153; background: transparent; border: 0; border-left: 1px solid #e0e6da; font-size: 9px; cursor: pointer; }
.weekday-word { display: block; margin: 4px 0 0; color: var(--accent); font-family: var(--font-display); font-size: clamp(64px, 9vw, 98px); line-height: 1.1; letter-spacing: -.06em; }

.unlock-wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 26px; align-items: start; margin-top: 38px; scroll-margin-top: 30px; }
.premium-note { padding: 29px; background: var(--yellow); border-radius: var(--radius); box-shadow: 7px 7px 0 var(--ink); }
.premium-note h2 { margin: 10px 0 14px; font-family: var(--font-display); font-size: 28px; }
.premium-note ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.premium-note li { padding-bottom: 8px; border-bottom: 1px solid rgba(23, 58, 48, .18); font-size: 11.5px; }
.premium-note li::before { content: "✓"; margin-right: 7px; color: var(--green); font-weight: 800; }
.premium-note > p { margin: 16px 0 0; color: #4b5b3a; font-size: 10px; }

.guide-shell, .faq-shell { margin-top: 52px; scroll-margin-top: 30px; }
.guide-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding-bottom: 17px; border-bottom: 1px solid #cbd5c5; }
.guide-heading h2 { margin: 0; font-family: var(--font-display); font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.055em; }
.guide-heading > p { max-width: 430px; margin: 0 0 5px; color: var(--muted); font-size: 12px; text-align: right; }
.how-to-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 22px 0 0; padding: 0; list-style: none; }
.how-to-grid li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding: 21px; background: rgba(251, 252, 245, .9); border: 1px solid #cbd5c5; border-radius: 16px; box-shadow: 0 13px 35px rgba(28, 66, 52, .08); }
.how-to-grid li > span { display: grid; place-items: center; width: 42px; height: 42px; color: var(--card); background: var(--accent); border-radius: 50% 50% 50% 12px; font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.how-to-grid h3 { margin: 1px 0 8px; font-size: 16px; }
.how-to-grid p { margin: 0; color: #62756a; font-size: 12px; line-height: 1.8; }
.faq-list { display: grid; gap: 10px; margin-top: 20px; }
.faq-list details { overflow: clip; background: rgba(251, 252, 245, .88); border: 1px solid #cbd5c5; border-radius: 12px; }
.faq-list summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 54px; padding: 14px 18px; cursor: pointer; font-size: 13.5px; font-weight: 650; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; flex: 0 0 auto; color: var(--accent); font-family: var(--font-mono); font-size: 20px; line-height: 1; }
.faq-list details[open] summary { border-bottom: 1px solid #dce4d7; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list p { margin: 0; padding: 14px 18px 17px; color: #576b60; font-size: 12px; line-height: 1.9; }

.site-footer { margin-top: 74px; padding: 34px 0 20px; color: #dce6df; background: var(--ink); }
.footer-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 30px; }
.footer-brand span { font-family: var(--font-display); font-size: 20px; letter-spacing: .1em; }
.footer-brand p { margin: 3px 0 0; color: #829b8e; font-size: 10px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 9px 20px; justify-content: flex-end; font-size: 11px; }
.footer-links a { color: #c5d2ca; text-decoration: none; }
.footer-links a:hover { color: var(--yellow); }
.footer-base { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; padding-top: 15px; border-top: 1px solid #35594b; color: #718a7d; font-family: var(--font-mono); font-size: 8.5px; }

/* Shared referral card. */
.referral-card {
  position: relative; overflow: hidden; padding: clamp(24px, 4vw, 36px); color: #f7fbf4;
  background: #173a30; border: 1px solid var(--ink); border-radius: var(--radius);
  box-shadow: 7px 7px 0 var(--accent);
}
.referral-card::after { content: ""; position: absolute; width: 210px; height: 210px; right: -80px; top: -108px; border: 31px solid var(--accent); border-radius: 50%; opacity: .21; pointer-events: none; }
.referral-kicker { display: flex; align-items: center; gap: 8px; color: #9fb3a7; font-family: var(--font-mono); font-size: 9px; letter-spacing: .12em; }
.referral-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(223, 105, 63, .18); }
.referral-heading { position: relative; z-index: 1; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-top: 16px; }
.referral-heading h2 { margin: 0; font-family: var(--font-display); font-size: clamp(25px, 3vw, 35px); line-height: 1.22; letter-spacing: -.03em; }
.referral-heading p { max-width: 560px; margin: 9px 0 0; color: #afc2b7; font-size: 12px; }
.referral-badge { flex: 0 0 auto; padding: 5px 9px; border: 1px solid #5c7b6b; border-radius: 100px; color: #bfd0c6; font-family: var(--font-mono); font-size: 8.5px; }
.referral-badge.is-unlocked, .referral-badge.is-trial { color: var(--ink); background: #d9efc7; border-color: #d9efc7; }
.referral-badge.is-trial { background: #ffd8c7; border-color: #ffd8c7; }
.referral-progress { display: flex; align-items: center; gap: 12px; margin-top: 21px; color: #d3e0d8; font-size: 11px; }
.referral-steps { display: flex; gap: 5px; }
.referral-steps i { width: 32px; height: 5px; border-radius: 10px; background: #426052; }
.referral-steps i.is-filled { background: var(--yellow); }
.referral-label { display: block; margin: 24px 0 7px; color: #93aa9d; font-size: 9px; }
.referral-copy-row { display: flex; gap: 8px; }
.referral-link { min-width: 0; flex: 1; color: #eef6f0 !important; background: #254a3e !important; border-color: #557466 !important; font-family: var(--font-mono); font-size: 10px; }
.referral-copy { flex: 0 0 auto; padding: 9px 14px; color: var(--ink); background: var(--yellow); border: 1px solid var(--yellow); border-radius: 8px; font-weight: 700; font-size: 11px; cursor: pointer; }
.referral-copy.is-copied { background: #d9efc7; border-color: #d9efc7; }
.referral-foot { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-top: 12px; color: #849d90; font-size: 9.5px; }
.referral-refresh { flex: 0 0 auto; padding: 0; color: #b5c7bd; background: transparent; border: 0; border-bottom: 1px solid #587366; font-size: 9px; cursor: pointer; }
.referral-trial { margin-top: 15px; padding: 9px 11px; color: #ffe2d5; background: rgba(223, 105, 63, .15); border: 1px solid rgba(223, 105, 63, .32); border-radius: 7px; font-size: 10px; }

.share-prompt {
  position: fixed; z-index: 80; left: 50%; bottom: 18px; width: min(660px, calc(100% - 24px));
  display: flex; align-items: center; gap: 14px; padding: 14px 54px 14px 18px;
  color: var(--card); background: var(--ink); border: 1px solid #cbd5c5; border-radius: 15px;
  box-shadow: 5px 5px 0 var(--yellow); transform: translateX(-50%); animation: share-prompt-in .2s ease-out;
}
body.has-share-prompt { padding-bottom: 96px; }
.share-prompt-copy { display: flex; flex: 1; flex-wrap: wrap; gap: 0 5px; min-width: 0; line-height: 1.5; }
.share-prompt-copy strong { font-size: 13px; }
.share-prompt-copy span { color: #b8c9bf; font-size: 12px; }
.share-prompt-action { flex: 0 0 auto; min-height: 44px; padding: 9px 15px; color: var(--ink); background: var(--yellow); border: 1px solid var(--yellow); border-radius: 8px; font-size: 12px; font-weight: 700; cursor: pointer; }
.share-prompt-action.is-copied { background: #d9efc7; border-color: #d9efc7; }
.share-prompt-close { position: absolute; top: 50%; right: 8px; width: 44px; height: 44px; padding: 0; color: #b8c9bf; background: transparent; border: 0; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; transform: translateY(-50%); }
.share-prompt-close:hover { color: var(--card); background: rgba(255, 255, 255, .08); }
.share-prompt.is-leaving { opacity: 0; transform: translateX(-50%) translateY(8px); transition: opacity .18s ease, transform .18s ease; }
@keyframes share-prompt-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

@media (max-width: 880px) {
  .hero { grid-template-columns: 1fr; }
  .today-board { justify-self: start; width: min(320px, 84vw); min-height: 300px; }
  .today-board > strong { font-size: 104px; }
  .calculator { grid-template-columns: 1fr; }
  .mode-rail { position: static; }
  .mode-list { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; padding-bottom: 3px; }
  .mode-button { min-width: 128px; }
  .rail-note { display: none; }
  .unlock-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  body { overflow-x: hidden; }
  .shell { width: min(100% - 24px, 1160px); }
  .site-header { padding: 15px 0; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 17px; }
  .top-nav { gap: 14px; font-size: 11px; }
  .hero { gap: 34px; padding-top: 48px; }
  .hero h1 { font-size: clamp(48px, 15vw, 68px); }
  .hero-copy > p:last-child { font-size: 14px; }
  .today-board { min-height: 260px; padding: 29px; }
  .today-board > strong { font-size: 88px; }
  .today-board > p { margin-top: 22px; }
  .mode-rail { padding: 17px; }
  .rail-title { margin-bottom: 10px; }
  .mode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-button { min-width: 0; padding: 10px; }
  .mode-button small { display: none; }
  .mode-button > span { grid-row: auto; }
  .tool-panel { padding: 21px; }
  .panel-heading { padding-bottom: 18px; }
  .mode-stamp { width: 44px; height: 44px; font-size: 19px; }
  .calculator-form { gap: 11px; }
  .date-field { flex-basis: 100%; }
  .date-arrow { display: none; }
  .calculate-button { width: 100%; }
  .result-sheet, .countdown-sheet, .weekday-sheet { padding: 17px; }
  .result-grid { grid-template-columns: 1fr; }
  .result-actions, .age-layout { align-items: flex-start; flex-direction: column; gap: 12px; }
  .age-layout { gap: 16px; }
  .countdown-clock div { min-width: 48px; }
  .countdown-clock strong { font-size: clamp(30px, 10vw, 44px); }
  .countdown-clock i { font-size: 20px; }
  .countdown-actions { align-items: stretch; flex-direction: column; }
  .saved-main { grid-template-columns: 1fr; }
  .saved-main small { grid-column: 1; grid-row: auto; justify-self: start; }
  .footer-main, .footer-base { flex-direction: column; }
  .footer-links { justify-content: flex-start; }
  .referral-heading { flex-direction: column; }
  .referral-copy-row { flex-direction: column; }
  .referral-foot { flex-direction: column; gap: 8px; }
  .guide-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .guide-heading > p { text-align: left; }
  .how-to-grid { grid-template-columns: 1fr; }
  .share-prompt { align-items: stretch; flex-direction: column; gap: 10px; }
  .share-prompt-action { width: 100%; }
  body.has-share-prompt { padding-bottom: 150px; }
}

@media (max-width: 620px), (pointer: coarse) {
  button, input:not([type="range"]):not([type="checkbox"]):not([type="radio"]), select { min-height: 44px; }
  input[type="range"] { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; }
  input[type="color"] { min-width: 44px; }
  .brand, .top-nav a, .footer-links a, .text-export, .referral-refresh, .saved-delete, .premium-check { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* polish: mobile form comfort */
@media (max-width:700px){
  .studio-card label,.calculator-form label,.field,.date-field,.control-row,.stats-card label{display:block;margin:.55rem 0}
  .studio-card input[type=text],.studio-card input[type=number],.studio-card input[type=date],.studio-card input[type=time],.studio-card input[type=email],.studio-card textarea,
  .calculator-form input,.calculator-form select,.field input,.field select,.date-field input,textarea,select,input[type=text],input[type=number],input[type=date],input[type=time]{width:100%;max-width:100%;box-sizing:border-box}
  .mode-tabs,.encode-tabs,.direction-tabs{gap:.35rem;flex-wrap:wrap}
  .mode-tab,.mode-button{padding:.5rem .85rem;font-size:.9rem}
  #out,pre#out,.batch-results,pre#checkGuideOut{font-size:.82rem}
  .maker-actions,.countdown-actions,.result-actions,.plan-actions{display:flex;flex-wrap:wrap;gap:.5rem}
  .maker-actions .button,.result-actions button{flex:1 1 auto}
  .quick-row{display:flex;flex-wrap:wrap;gap:.4rem}
  .format-row{flex-wrap:wrap}
  .stats-primary{grid-template-columns:1fr 1fr}
  .preview-card canvas,canvas#qrCanvas{max-width:100%;height:auto}
}
