:root {
  --seat-pink: #F676A6;
  --seat-pink-strong: #E55A8C;
  --seat-cyan: #00c9e8;
  --tool48-account-bg: rgba(255,255,255,.58);
  --tool48-account-border: rgba(255,255,255,.6);
  --ink: #1b2330;
  --tool48-font-cjk: 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', 'Noto Sans SC', 'Microsoft YaHei', 'Noto Sans JP', 'Yu Gothic UI', 'Meiryo', sans-serif;
  --tool48-font-ja: 'Noto Sans JP', 'Yu Gothic UI', 'Yu Gothic', 'Meiryo', 'Hiragino Sans', 'KozGoPr6N', sans-serif;
  --tool48-font-sc: 'Noto Sans SC', 'Microsoft YaHei', 'PingFang SC', 'Noto Sans TC', 'Noto Sans JP', sans-serif;
}

* { box-sizing: border-box; }
body { font-family: var(--tool48-font-cjk); font-size: 15px; line-height: 1.46; }
html[lang="ja"] body { font-family: var(--tool48-font-ja); }
html[lang="zh-Hans"] body { font-family: var(--tool48-font-sc); }
button, select, input, .nav-icon, .field-label { flex-shrink: 0; white-space: nowrap; }
.selected-pill { flex-shrink: 1; }

.app-shell { width: min(1260px, calc(100vw - 28px)); margin: 0 auto; padding: 28px 0 44px; }
.account-topbar { position:sticky; top:12px; z-index:30; display:flex; align-items:center; justify-content:flex-start; gap:12px; margin-bottom:12px; padding:9px 10px; border-radius:22px; background:rgba(255,255,255,.58); border:1px solid rgba(255,255,255,.72); box-shadow:0 18px 52px rgba(31,41,55,.12), inset 0 1px 0 rgba(255,255,255,.78); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); }
.tool48-home-link { display:inline-flex; align-items:center; justify-content:center; min-height:38px; padding:8px 12px; border-radius:999px; border:1px solid var(--tool48-account-border); background:var(--tool48-account-bg); color:var(--seat-pink); text-decoration:none; font-size:.78rem; font-weight:900; box-shadow:0 8px 22px rgba(246,118,166,.14); flex-shrink:0; }
.tool48-home-link:hover { background:rgba(255,255,255,.92); }
.account-brand { display:inline-flex; align-items:center; gap:10px; min-width:0; color:var(--ink); text-decoration:none; margin-right:auto; }
.account-brand-mark { width:40px; height:40px; border-radius:15px; display:grid; place-items:center; color:#fff; font-weight:900; background:linear-gradient(135deg,var(--seat-pink),var(--seat-pink-strong)); box-shadow:0 12px 28px rgba(246,118,166,.2); }
.account-brand span:last-child { min-width:0; }
.account-brand strong,.account-brand em { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.account-brand strong { font-family:var(--tool48-font-cjk); font-size:.92rem; line-height:1.15; letter-spacing:0; }
.account-brand em { margin-top:2px; color:var(--text-sec); font-size:.72rem; font-style:normal; font-weight:800; }
.account-topbar-actions { display:flex; align-items:center; gap:8px; flex-shrink:0; margin-left:auto; }
.account-toggle { display:inline-flex; align-items:center; justify-content:center; gap:6px; max-width:170px; min-height:38px; padding-inline:12px; border-radius:999px; background:var(--tool48-account-bg); color:var(--seat-pink); border-color:var(--tool48-account-border); font-weight:800; box-shadow:0 8px 22px rgba(246,118,166,.14); }
.account-toggle::before { content:""; width:18px; height:18px; flex-shrink:0; background:currentColor; -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center/contain no-repeat; mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Ccircle cx='12' cy='10' r='3'/%3E%3Cpath d='M7 20.7c1.2-2.1 3-3.2 5-3.2s3.8 1.1 5 3.2'/%3E%3C/svg%3E") center/contain no-repeat; }
.account-popover { position:absolute; top:calc(100% + 8px); right:0; width:min(360px, calc(100vw - 24px)); padding:14px; border-radius:18px; background:rgba(255,255,255,.94); border:1px solid rgba(255,255,255,.78); box-shadow:0 20px 60px rgba(27,35,48,.18); display:grid; gap:10px; }
.account-popover[hidden] { display:none!important; }
.account-popover { max-height:calc(100dvh - 70px); overflow:auto; z-index:260; }
.apple-glass-3d { transform:none!important; transition:box-shadow .16s ease!important; }
.hover-glow:hover { transform:none!important; }
.hero { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:18px; padding:22px clamp(18px,4vw,34px); margin-bottom:18px; background:rgba(255,255,255,.38); }
.eyebrow { margin:0 0 6px; font-size:.78rem; font-weight:900; letter-spacing:.14em; text-transform:uppercase; color:var(--seat-pink-strong); }
.hero h1 { margin:0; font-family:var(--tool48-font-cjk); font-size:clamp(1.55rem,3.6vw,2.8rem); line-height:1.08; font-weight:900; letter-spacing:0; color:var(--seat-pink-strong); text-shadow:0 2px 10px rgba(246,118,166,.18); }
.lead { margin:9px 0 0; color:var(--text-sec); font-weight:600; line-height:1.52; font-size:.94rem; }
.hero-copy { min-width: 0; }
.hero-actions { justify-self:end; display:flex; align-items:end; gap:8px; padding-top:2px; margin-inline-end:clamp(8px,1.8vw,22px); }
.lang-label { font-size:.76rem; color:var(--seat-pink-strong); }
.lang-input { width:170px; min-width:170px; min-height:40px; }
.hero-badge { width:74px; height:74px; border-radius:28px; display:grid; place-items:center; color:#fff; font-size:2rem; font-weight:900; background:linear-gradient(135deg,var(--seat-pink),#ff8ec4 48%,var(--seat-cyan)); box-shadow:0 18px 44px rgba(255,0,127,.26); }
.workspace { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:18px; align-items:start; }
.tab-nav { margin:0 0 14px; padding:8px; display:flex; gap:8px; overflow-x:auto; background:rgba(255,255,255,.38); border-radius:22px; }
.tab-nav::-webkit-scrollbar { display:none; }
.tab-button { min-height:40px; border:0; border-radius:16px; padding:0 14px; color:var(--text-sec); background:transparent; cursor:pointer; font:inherit; font-size:.84rem; font-weight:900; white-space:nowrap; }
.tab-button.active { color:#fff; background:linear-gradient(135deg,var(--seat-pink-strong),#ff7ab9 56%,var(--seat-cyan)); box-shadow:0 12px 28px rgba(255,0,127,.22); }
.tab-panel { display:none; }
.tab-panel.active { display:grid; }
.records-card { padding:18px; background:rgba(255,255,255,.42); border-radius:24px; box-shadow:0 8px 24px rgba(27,35,48,.06); }
.section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; margin-bottom:16px; }
.section-head.compact { margin-bottom:14px; }
.section-head h2 { margin:0; font-size:clamp(1.22rem,2.6vw,1.82rem); line-height:1.14; font-weight:900; letter-spacing:0; }
.map-card,.control-card { background:rgba(255,255,255,.42); }
.map-card { padding:14px; border-radius:24px; box-shadow:0 8px 24px rgba(27,35,48,.06); }
.map-toolbar { display:flex; align-items:center; justify-content:flex-start; gap:10px; margin-bottom:12px; }
.selected-pill { width:100%; min-width:0; max-width:100%; padding:10px 14px; border-radius:999px; background:rgba(255,255,255,.8); border:1px solid rgba(255,79,163,.22); color:var(--ink); font-size:.92rem; font-weight:800; overflow:hidden; text-overflow:ellipsis; white-space:normal; line-height:1.45; }
.map-scroll { width:100%; overflow:auto; padding:10px; border-radius:22px; background:rgba(255,255,255,.58); border:1px solid rgba(255,255,255,.7); overscroll-behavior:contain; }
.map-stage { position:relative; width:min(100%,920px); max-width:none; min-width:0; margin:0 auto; aspect-ratio:760 / 640; user-select:none; transform-origin:top center; }
.seatmap-base,.seat-overlay { position:absolute; inset:0; width:100%; height:100%; }
.seatmap-base { object-fit:contain; border-radius:14px; background:#fff; filter:drop-shadow(0 14px 32px rgba(27,35,48,.08)); }
.seat-overlay { z-index:2; overflow:visible; }
.seat-hit { cursor:pointer; fill:rgba(255,79,163,.01); stroke:transparent; stroke-width:1.6; transition:fill .16s ease, stroke .16s ease, filter .16s ease, transform .16s ease; transform-box:fill-box; transform-origin:center; }
.seat-hit:hover,.seat-hit.is-selected { fill:rgba(255,79,163,.34); stroke:#ff007f; filter:url(#seatGlow); transform:scale(1.08); }
.selection-rect { fill:rgba(255,0,127,.26); stroke:#ff007f; stroke-width:2.8; filter:url(#selectionGlow); animation:selectedPulse 1.15s ease-in-out infinite; }
@keyframes selectedPulse { 0%,100%{opacity:.86;} 50%{opacity:1;} }
.arrow-callout { pointer-events:none; filter:url(#arrowGlow); }
.arrow-callout .arrow-body { fill:#ff007f; stroke:#fff; stroke-width:3; }
.arrow-callout .arrow-label-bg { fill:rgba(255,255,255,.97); stroke:#ff007f; stroke-width:1.6; }
.arrow-callout text { fill:#ff007f; font-size:12px; font-weight:900; text-anchor:middle; dominant-baseline:middle; font-family:'Noto Sans JP',sans-serif; }
.control-card { position:sticky; top:calc(18px + env(safe-area-inset-top)); padding:18px; display:flex; flex-direction:column; gap:16px; }
.control-card.apple-glass-3d { --rx:0deg; --ry:0deg; }
.control-section { display:flex; flex-direction:column; gap:7px; }
.control-section[hidden] { display:none!important; }
.custom-performance-section { grid-column:1 / -1; }
.field-label { font-size:.78rem; font-weight:900; color:var(--text-main); }
.control-input { width:100%; min-height:40px; border:1px solid rgba(255,64,129,.18); border-radius:15px; padding:0 12px; background:rgba(255,255,255,.86); color:var(--text-main); font:inherit; font-weight:700; outline:none; box-shadow:inset 0 1px 0 rgba(255,255,255,.8); }
.control-input:focus { border-color:var(--seat-pink); box-shadow:0 0 0 4px rgba(255,79,163,.13); }
.summary-box { padding:14px; border-radius:20px; background:rgba(255,255,255,.72); border:1px solid rgba(255,64,129,.16); }
.summary-label { margin:0 0 4px; font-size:.74rem; color:var(--seat-pink-strong); font-weight:900; letter-spacing:.08em; text-transform:uppercase; }
.summary-main { margin:0; font-size:1.18rem; font-weight:900; color:var(--ink); line-height:1.3; }
.summary-sub { margin:8px 0 0; color:var(--text-sec); font-size:.9rem; line-height:1.55; }
.button-row { display:grid; grid-template-columns:1fr .82fr; gap:10px; }
.primary-button,.secondary-button,.ghost-button,.link-button { min-height:44px; border:none; border-radius:16px; padding:0 15px; font:inherit; font-weight:900; cursor:pointer; transition:transform .16s ease, box-shadow .16s ease, opacity .16s ease; text-decoration:none; display:inline-flex; align-items:center; justify-content:center; }
.primary-button { color:#fff; background:linear-gradient(135deg,#ff007f,#ff6faf 56%,#00c9e8); box-shadow:0 14px 32px rgba(255,0,127,.26); }
.secondary-button,.ghost-button { color:var(--seat-pink-strong); background:rgba(255,255,255,.82); border:1px solid rgba(255,64,129,.2); }
.account-topbar .account-toggle.ghost-button { border-radius:999px; background:var(--tool48-account-bg); color:var(--seat-pink); border-color:var(--tool48-account-border); box-shadow:0 8px 22px rgba(246,118,166,.14); }
.link-button { width:100%; color:var(--ink); background:rgba(255,255,255,.55); border:1px dashed rgba(255,64,129,.35); }
.primary-button:hover,.secondary-button:hover,.ghost-button:hover,.link-button:hover { transform:translateY(-1px); box-shadow:0 12px 26px rgba(27,35,48,.1); }
button:disabled { opacity:.48; cursor:not-allowed; transform:none!important; }
.notes { padding:12px 13px; border-radius:16px; background:rgba(0,201,232,.09); color:#25718a; font-size:.84rem; font-weight:700; line-height:1.6; }
.notes p { margin:0; }
.memo-panel { display:flex; flex-direction:column; gap:10px; }
.memo-section { display:flex; flex-direction:column; gap:10px; padding:12px; border-radius:16px; background:rgba(255,255,255,.68); border:1px solid rgba(255,64,129,.15); min-width:0; }
.memo-section-head { display:flex; flex-direction:column; gap:3px; min-width:0; }
.memo-title { margin:0; color:var(--ink); font-size:.84rem; font-weight:900; line-height:1.3; overflow-wrap:anywhere; }
.memo-status { margin:0; color:var(--text-sec); font-size:.76rem; font-weight:800; line-height:1.45; overflow-wrap:anywhere; }
.memo-button-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; min-width:0; }
.memo-button-grid { display:grid; grid-template-columns:1fr 1fr; gap:8px; min-width:0; }
.memo-button { min-width:0; min-height:40px; padding-inline:10px; font-size:.82rem; line-height:1.25; white-space:normal; text-align:center; }
.cloud-login-form { display:grid; grid-template-columns:1fr; gap:8px; min-width:0; }
.cloud-login-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; gap:8px; align-items:center; min-width:0; }
.cloud-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; min-width:0; }
.cloud-actions[hidden],.cloud-login-form[hidden] { display:none!important; }
.cloud-user-pill { min-width:0; max-width:100%; padding:8px 10px; border-radius:999px; color:var(--ink); background:rgba(255,255,255,.76); font-size:.78rem; font-weight:900; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cloud-record-controls { display:flex; flex-direction:column; gap:8px; min-width:0; }
.cloud-email-input,.cloud-record-select { min-width:0; min-height:40px; font-size:.84rem; }
.cloud-save-section.is-local-only .cloud-record-controls { opacity:.62; }
.records-table-wrap { width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
.records-table { width:100%; min-width:720px; border-collapse:separate; border-spacing:0 8px; }
.records-table th { padding:0 10px 4px; color:var(--seat-pink-strong); font-size:.76rem; font-weight:900; text-align:left; white-space:nowrap; }
.records-table td { padding:12px 10px; background:rgba(255,255,255,.72); color:var(--ink); font-size:.86rem; font-weight:750; vertical-align:middle; }
.records-table td:first-child { border-radius:14px 0 0 14px; }
.records-table td:last-child { border-radius:0 14px 14px 0; }
.record-empty { padding:20px; border-radius:18px; background:rgba(255,255,255,.6); color:var(--text-sec); font-weight:800; text-align:center; }
.record-empty[hidden] { display:none!important; }
.record-buttons { display:flex; flex-wrap:nowrap; gap:7px; justify-content:flex-end; }
.record-buttons button { min-height:34px; border:0; border-radius:999px; padding:0 11px; background:rgba(255,255,255,.9); color:var(--ink); font:inherit; font-size:.78rem; font-weight:900; white-space:nowrap; }
.record-buttons .delete { color:#fff; background:#ef4444; }
.lottery-card { display:flex; flex-direction:column; gap:14px; }
.lottery-form-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.lottery-custom-performance { grid-column:1 / -1; }
.lottery-help { margin:0; padding:10px 12px; border-radius:14px; background:rgba(0,201,232,.09); color:#25718a; font-size:.82rem; font-weight:800; line-height:1.5; overflow-wrap:anywhere; }
.lottery-layout { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.lottery-range-column { display:flex; flex-direction:column; gap:8px; min-width:0; }
.lottery-range-button { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; min-height:44px; padding:8px 12px; border:1px solid rgba(255,64,129,.18); border-radius:14px; background:rgba(255,255,255,.74); color:var(--ink); font:inherit; cursor:pointer; }
.lottery-range-button strong { font-size:.92rem; font-weight:900; }
.lottery-range-button span { min-width:76px; color:var(--text-sec); font-size:.78rem; font-weight:900; text-align:right; }
.lottery-range-button.is-marked { border-color:rgba(255,0,127,.56); background:rgba(255,255,255,.94); box-shadow:0 8px 18px rgba(255,0,127,.1); }
.lottery-range-button.is-self { background:linear-gradient(135deg,rgba(255,225,239,.96),rgba(226,250,255,.96)); border-color:var(--seat-pink-strong); }
.public-consent { display:flex; gap:10px; align-items:flex-start; padding:12px; border-radius:16px; background:rgba(255,255,255,.66); border:1px solid rgba(255,64,129,.15); }
.public-consent input { width:20px; height:20px; margin-top:2px; accent-color:var(--seat-pink-strong); }
.public-consent span { display:grid; gap:3px; min-width:0; }
.public-consent strong { color:var(--ink); font-size:.86rem; font-weight:900; }
.public-consent small { color:var(--text-sec); font-size:.76rem; font-weight:750; line-height:1.45; overflow-wrap:anywhere; }
.lottery-actions { margin-top:0; }
.lottery-record-list { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }
.lottery-record-card { min-width:0; padding:14px; border-radius:18px; background:rgba(255,255,255,.66); border:1px solid rgba(255,64,129,.15); box-shadow:0 8px 20px rgba(27,35,48,.05); }
.lottery-record-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:10px; align-items:start; margin-bottom:12px; }
.lottery-record-title-wrap { min-width:0; }
.lottery-record-title-wrap h3 { margin:0 0 5px; color:var(--ink); font-size:.98rem; font-weight:900; line-height:1.28; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.lottery-record-title-wrap p { margin:0; color:var(--text-sec); font-size:.72rem; font-weight:800; line-height:1.4; }
.lottery-record-badge { display:inline-flex; align-items:center; justify-content:center; min-height:26px; padding:0 9px; border-radius:999px; font-size:.68rem; font-weight:900; white-space:nowrap; }
.lottery-record-badge.is-public { color:#0f766e; background:rgba(20,184,166,.12); border:1px solid rgba(20,184,166,.22); }
.lottery-record-badge.is-private { color:var(--seat-pink-strong); background:rgba(255,255,255,.82); border:1px solid rgba(255,64,129,.18); }
.lottery-record-chip-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:7px; }
.lottery-record-chip { display:grid; place-items:center; min-height:30px; border-radius:10px; color:var(--ink); background:rgba(255,255,255,.9); border:1px solid rgba(255,64,129,.18); font-size:.78rem; font-weight:900; line-height:1; box-shadow:inset 0 1px 0 rgba(255,255,255,.9); }
.lottery-record-chip.is-self { color:#fff; background:linear-gradient(135deg,var(--seat-pink-strong),#ff87bd); border-color:rgba(255,64,129,.38); }
.lottery-record-note { margin:10px 0 0; color:#0f766e; font-size:.72rem; font-weight:850; line-height:1.45; }
.lottery-record-actions { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:7px; margin-top:12px; }
.lottery-record-actions button { min-width:0; min-height:32px; border:0; border-radius:999px; padding:0 8px; background:rgba(255,255,255,.9); color:var(--ink); font:inherit; font-size:.72rem; font-weight:900; line-height:1.1; white-space:normal; cursor:pointer; }
.lottery-record-actions .delete { color:#fff; background:#ef4444; }
.distribution-filters { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:14px; padding:12px; border-radius:18px; background:rgba(255,255,255,.56); border:1px solid rgba(255,64,129,.12); }
#tab-distribution .records-card { max-width:1060px; margin-inline:auto; }
.distribution-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; max-width:960px; margin-inline:auto; }
.chart-box { min-width:0; max-width:475px; justify-self:stretch; padding:10px; border-radius:16px; background:rgba(255,255,255,.58); border:1px solid rgba(255,255,255,.7); }
.chart-box-wide { grid-column:1 / -1; width:100%; max-width:960px; justify-self:center; }
.chart-box h3 { margin:0 0 10px; color:var(--ink); font-size:1rem; font-weight:900; line-height:1.3; }
.chart-note { margin:-4px 0 8px; color:var(--text-sec); font-size:.82rem; font-weight:750; line-height:1.55; }
.distribution-canvas { display:block; width:100%; max-width:100%; height:auto; margin-top:8px; border-radius:14px; background:#fff; box-shadow:0 10px 24px rgba(27,35,48,.07); }
.compact-chart { margin-top:10px; }
.modal-backdrop { position:fixed; inset:0; z-index:10000; display:none; place-items:center; padding:24px; background:rgba(20,28,38,.44); backdrop-filter:blur(10px); }
.modal-backdrop:not([hidden]) { display:grid; }
.modal-backdrop[hidden] { display:none!important; }
.export-modal { width:min(620px,100%); max-height:min(88dvh,900px); overflow:auto; padding:22px; background:rgba(255,255,255,.88); text-align:center; }
.export-modal h2 { margin:4px 0 8px; font-size:1.45rem; font-weight:900; }
.export-modal p { margin:0 0 14px; color:var(--text-sec); font-weight:700; }
.modal-close { position:sticky; top:0; margin-left:auto; display:grid; place-items:center; width:38px; height:38px; border-radius:999px; border:0; background:rgba(255,255,255,.9); color:var(--ink); font-size:1.4rem; font-weight:900; cursor:pointer; }
.export-preview { display:block; width:100%; max-height:62dvh; object-fit:contain; border-radius:16px; background:#fff; box-shadow:0 16px 40px rgba(27,35,48,.16); -webkit-user-select:auto; user-select:auto; }
.modal-link { margin-top:14px; }
.toast { position:fixed; left:50%; bottom:calc(24px + env(safe-area-inset-bottom)); z-index:10001; transform:translateX(-50%) translateY(20px); padding:12px 16px; border-radius:999px; background:rgba(27,35,48,.92); color:#fff; font-weight:800; opacity:0; pointer-events:none; transition:opacity .2s ease, transform .2s ease; }
.toast.show { opacity:1; transform:translateX(-50%) translateY(0); }
@media (max-width:980px) { .workspace { grid-template-columns:1fr; } .control-card { position:static; } .map-stage { width:100%; min-width:0; } }
@media (max-width:560px) {
  body { font-size: 14px; }
  .app-shell { width:100%; max-width:100%; padding:12px 10px 34px; }
  .hero { grid-template-columns:1fr; align-items:stretch; gap:14px; padding:18px 16px; border-radius:22px; }
  .hero h1 { font-size:clamp(1.45rem,7.2vw,2.05rem); line-height:1.08; white-space:normal; overflow-wrap:keep-all; }
  .lead { font-size:.86rem; line-height:1.48; }
  .hero-actions { justify-self:stretch; width:100%; align-items:stretch; flex-direction:column; gap:6px; margin-inline-end:0; }
  .lang-input { width:100%; min-width:0; }
  .map-card,.control-card { border-radius:22px; }
  .map-toolbar { align-items:stretch; flex-direction:column; }
  .map-scroll { padding:7px; }
  .map-stage { min-width:0; }
  .button-row { grid-template-columns:1fr; }
}


.site-footer {
  margin-top: 18px;
  padding: 14px 18px;
  background: rgba(255,255,255,.46);
  border-radius: 22px;
  color: var(--text-sec);
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.7;
}
.site-footer p { margin: 0; }
.site-footer p + p { margin-top: 5px; font-weight: 800; }


/* v3.2.0 mobile / background stability fixes */
html, body {
  min-height: 100%;
  overflow-x: hidden;
}
body {
  animation: none !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255,79,163,.18), transparent 34rem),
    radial-gradient(circle at 90% 8%, rgba(0,201,232,.14), transparent 30rem),
    linear-gradient(135deg, #fff7fb 0%, #eef8ff 52%, #ffffff 100%) !important;
  background-size: cover !important;
  background-attachment: fixed;
}
.site-footer {
  width: 100%;
  max-width: 100%;
}
.site-footer p {
  white-space: normal;
  overflow-wrap: break-word;
}
@media (max-width:560px) {
  .site-footer {
    width: 100%;
    margin-top: 14px;
    padding: 14px 16px;
    border-radius: 18px;
    font-size: .76rem;
    line-height: 1.65;
  }
  .site-footer p {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}


/* v3.5.0 mobile zoom / overflow / Safari preview fixes */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
}
.app-shell,
.hero,
.workspace,
.map-card,
.control-card,
.site-footer,
.map-toolbar,
.summary-box,
.notes {
  max-width: 100%;
  min-width: 0;
}
button, select, input, textarea {
  max-width: 100%;
}
.map-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}
.map-scroll {
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
  contain: layout paint;
}
.map-stage {
  max-width: none !important;
  min-width: 0 !important;
  will-change: width;
}
.zoom-control {
  display: inline-grid;
  grid-template-columns: 40px minmax(52px, auto) 40px;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(255,64,129,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7);
}
.zoom-button {
  width: 40px;
  height: 36px;
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: rgba(255,79,163,.12);
  color: var(--seat-pink-strong);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}
.zoom-button:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.zoom-level {
  min-width: 52px;
  text-align: center;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
}
.modal-backdrop {
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  overflow: auto;
}
.export-modal {
  width: min(620px, calc(100vw - 24px));
  max-width: 100%;
}
.export-preview {
  max-width: 100%;
  height: auto;
  -webkit-touch-callout: default !important;
  -webkit-user-select: auto !important;
  user-select: auto !important;
}
.modal-link { display: none !important; }
@media (max-width: 560px) {
  button, select, input, textarea, .field-label {
    min-width: 0;
  }
  .app-shell {
    width: 100%;
    max-width: 100vw;
    padding-left: 10px;
    padding-right: 10px;
  }
  .hero,
  .map-card,
  .control-card,
  .site-footer {
    width: 100%;
    max-width: calc(100vw - 20px);
  }
  .map-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .zoom-control {
    justify-self: center;
    width: min(100%, 178px);
  }
  .map-scroll {
    width: 100%;
    padding: 6px;
    overflow: auto;
  }
  .primary-button,
  .secondary-button,
  .link-button,
  .memo-button {
    white-space: normal;
    line-height: 1.3;
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .summary-main,
  .summary-sub,
  .notes p,
  .lead {
    overflow-wrap: anywhere;
  }
  body {
    background-attachment: scroll !important;
  }
}


/* v3.7.0 mobile comfort pass */
@media (max-width: 560px) {
  .app-shell {
    padding: 8px 8px 28px;
  }

  .account-topbar {
    top:8px;
    gap:8px;
    margin-bottom:8px;
    padding:8px;
    border-radius:18px;
  }

  .tool48-home-link {
    min-height:34px;
    padding:6px 8px;
    font-size:.7rem;
  }

  .account-brand-mark {
    width:36px;
    height:36px;
    border-radius:13px;
  }

  .account-brand em {
    display:none;
  }

  .account-toggle {
    max-width:116px;
    min-height:38px;
    padding-inline:12px;
  }

  .account-toggle::before {
    width:16px;
    height:16px;
  }

  .account-popover {
    right:0;
    width:calc(100vw - 16px);
  }

  .hero {
    gap: 8px;
    margin-bottom: 10px;
    padding: 12px;
    border-radius: 18px;
  }

  .eyebrow {
    margin-bottom: 2px;
    font-size: .68rem;
    line-height: 1.2;
    letter-spacing: .08em;
  }

  .hero h1 {
    font-size: clamp(1.28rem, 6.2vw, 1.72rem);
    line-height: 1.12;
    letter-spacing: 0;
  }

  .lead {
    display: -webkit-box;
    margin-top: 5px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .82rem;
    line-height: 1.45;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }

  .hero-actions .field-label {
    white-space: normal;
  }

  .lang-label {
    font-size: .7rem;
    line-height: 1.2;
  }

  .lang-input {
    min-height: 38px;
    border-radius: 13px;
    padding-inline: 10px;
  }

  .workspace {
    gap: 10px;
  }

  .tab-nav {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 10px;
    padding: 6px;
    overflow: visible;
    border-radius: 18px;
  }

  .tab-button {
    min-height: 38px;
    padding: 6px 3px;
    border-radius: 13px;
    font-size: 11px;
    line-height: 1.15;
    white-space: normal;
  }

  .records-card {
    max-width: calc(100vw - 16px);
    padding: 12px;
    border-radius: 18px;
  }

  .section-head {
    gap: 10px;
    margin-bottom: 12px;
  }

  .section-head h2 {
    font-size: 1.18rem;
  }

  .map-card,
  .control-card {
    max-width: calc(100vw - 16px);
    border-radius: 18px;
  }

  .map-card {
    padding: 10px;
  }

  .map-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .selected-pill {
    display: -webkit-box;
    max-height: 3.1em;
    padding: 8px 10px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    border-radius: 16px;
    font-size: .82rem;
    line-height: 1.32;
  }

  .zoom-control {
    width: min(100%, 166px);
  }

  .map-scroll {
    padding: 5px;
    border-radius: 16px;
  }

  .control-card {
    padding: 12px;
    gap: 12px;
  }

  .control-section {
    gap: 5px;
  }

  .field-label {
    font-size: .76rem;
  }

  .summary-box {
    padding: 11px;
    border-radius: 16px;
  }

  .summary-label {
    font-size: .68rem;
  }

  .summary-main {
    font-size: 1.02rem;
  }

  .summary-sub {
    margin-top: 6px;
    font-size: .82rem;
    line-height: 1.45;
  }

  .button-row {
    gap: 8px;
  }

  .primary-button,
  .secondary-button,
  .link-button {
    min-height: 44px;
    border-radius: 14px;
    padding-inline: 12px;
  }

  .notes {
    padding: 10px 11px;
    border-radius: 14px;
    font-size: .78rem;
    line-height: 1.5;
  }

  .memo-section {
    padding: 10px;
    border-radius: 14px;
    gap: 8px;
  }

  .memo-title {
    font-size: .8rem;
  }

  .memo-status {
    font-size: .72rem;
  }

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

  .memo-button-row,
  .memo-button-grid {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .memo-button,
  .cloud-email-input,
  .cloud-record-select {
    min-height: 40px;
  }

  .records-table {
    min-width: 660px;
  }

  .record-buttons {
    justify-content: flex-start;
  }

  .lottery-form-row,
  .lottery-layout,
  .distribution-filters,
  .distribution-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .lottery-range-button {
    min-height: 40px;
    padding: 7px 10px;
  }

  .lottery-range-button strong {
    font-size: .86rem;
  }

  .lottery-range-button span {
    min-width: 68px;
    font-size: .72rem;
  }

  .public-consent {
    padding: 10px;
    border-radius: 14px;
  }

  .site-footer {
    max-width: calc(100vw - 16px);
    margin-top: 10px;
    border-radius: 16px;
  }
}

@media (max-width: 380px) {
  .hero {
    padding: 10px;
  }

  .hero h1 {
    font-size: clamp(1.18rem, 6vw, 1.45rem);
  }

  .lead {
    -webkit-line-clamp: 1;
  }
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  text-align: left;
  border: 1px solid rgba(255,255,255,.68);
  box-shadow: 0 10px 28px rgba(27,35,48,.08);
}
.footer-copy {
  min-width: 0;
  flex: 1 1 360px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 14px;
  flex: 0 0 auto;
}
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--seat-pink-strong);
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}
.footer-link-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: var(--footer-icon) center / contain no-repeat;
  mask: var(--footer-icon) center / contain no-repeat;
}
.footer-link-icon-bug { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 2 1.9 1.9'/%3E%3Cpath d='M14.1 3.9 16 2'/%3E%3Cpath d='M9 7h6'/%3E%3Cpath d='M8 7v8a4 4 0 0 0 8 0V7'/%3E%3Cpath d='M3 13h4'/%3E%3Cpath d='M17 13h4'/%3E%3Cpath d='m5 19 3-3'/%3E%3Cpath d='m19 19-3-3'/%3E%3C/svg%3E"); }
.footer-link-icon-heart { --footer-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 21s-7.5-4.4-10-9.2C.3 8.5 2.3 4.5 6 4.2c2.1-.2 3.7.9 4.7 2.2.4.5 1 .5 1.4 0 1-1.3 2.6-2.4 4.7-2.2 3.7.3 5.7 4.3 4 7.6C19.5 16.6 12 21 12 21z'/%3E%3C/svg%3E"); }

@media (max-width: 560px) {
  .site-footer {
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 10px;
    font-size: .6rem;
    line-height: 1.35;
    text-align: left;
  }
  .footer-copy { flex: 1 1 220px; }
  .footer-copy p { display: inline; }
  .footer-copy p + p { margin-top: 0; }
  .footer-copy p + p::before { content: " "; }
  .footer-links { width: auto; gap: 8px 10px; flex: 0 0 auto; }
  .footer-link-icon { width: 12px; height: 12px; }
}

@media (max-width: 560px) {
  body { font-size: 14px; line-height: 1.42; }
  .hero h1 { font-family: var(--tool48-font-cjk); color: var(--seat-pink-strong); font-size: clamp(1.4rem, 6.6vw, 1.86rem); line-height: 1.1; text-shadow: 0 2px 10px rgba(246,118,166,.18); }
  .lead { font-size: .84rem; line-height: 1.44; }
  .section-head h2 { font-size: clamp(1.08rem, 5vw, 1.35rem); }
  .tab-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .tab-button { min-height: 34px; padding: 6px 3px; font-size: .68rem; line-height: 1.08; }
  .control-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .summary-box,
  .button-row,
  .link-button,
  .memo-panel,
  .notes { grid-column: 1 / -1; }
  .button-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lottery-form-row,
  .distribution-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lottery-record-list { grid-template-columns: 1fr; gap: 10px; }
  .lottery-record-card { padding: 12px; border-radius: 16px; }
  .lottery-record-title-wrap h3 { font-size: .9rem; white-space: normal; }
  .lottery-record-chip-grid { gap: 5px; }
  .lottery-record-chip { min-height: 28px; border-radius: 9px; font-size: .72rem; }
  .lottery-record-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .lottery-record-actions button { min-height: 34px; font-size: .7rem; }
  #tab-distribution .records-card { max-width: none; }
  .distribution-filters .control-input { min-width: 0; }
  .field-label,
  .memo-title,
  .summary-sub,
  .notes,
  .lottery-help,
  .chart-note { font-size: .72rem; line-height: 1.38; }
  .control-input,
  .cloud-email-input,
  .cloud-record-select { min-height: 38px; font-size: .78rem; }
}
