/* 全画面の正式デザイン。保存・集計処理から独立した共通部品。 */
:root{background:var(--mh-bg);--editorial-ink:var(--mh-text);--editorial-muted:var(--mh-muted);--editorial-line:var(--mh-border);--editorial-soft:var(--mh-selected);--editorial-radius:var(--mh-radius);--editorial-input-line:var(--mh-border);--editorial-danger:var(--mh-error);--editorial-candy:#A66B83;--editorial-shard:#B58A37;--editorial-space:var(--mh-gutter);--editorial-section:var(--mh-section-gap)}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])){background:#fff;color:var(--editorial-ink);-webkit-font-smoothing:antialiased}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app{max-width:840px;padding:24px var(--editorial-space) calc(120px + env(safe-area-inset-bottom))}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app>header{display:flex;flex-direction:column;align-items:flex-start;gap:5px;margin:0 0 24px;padding:0 0 20px;border-bottom:1px solid var(--editorial-line)}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app>header .series-icon{display:none}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app>header h1{order:0;margin:0;font-size:16px;font-weight:600;line-height:1.5;letter-spacing:.2px;color:var(--editorial-ink)}
body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app>header small{order:1;font-size:9px;font-weight:400;line-height:1.5;letter-spacing:1.5px;color:#909497}
body .app>:is(#record,#sleep,#summary,#shards,#team,#history,#settings)>.editorial-page-title{font-size:28px;font-weight:700;line-height:1.3;letter-spacing:-.5px;color:var(--editorial-ink);margin:0 0 16px}
:is(#summary,#shards){--accent:#555;--edge:var(--editorial-line);--tint:var(--editorial-soft);--resource-bg:#fff;--resource-color:#DCDDDF;--heat-0:#F7F8F8;--heat-1:#EFF1F1;--heat-2:#E1E5E5;--heat-3:#CDD3D3;--heat-4:#B3BDBD;color:var(--editorial-ink)}
:is(#summary,#shards) :is(.help,.mew,.delibird){color:var(--editorial-ink)}
:is(#summary,#shards) :is(.card,.hero,.overview-header){border:0;border-radius:0;box-shadow:none;background:transparent;padding:0;margin:0;min-width:0}
:is(#summary,#shards)>.card{padding:var(--editorial-section) 0;border-top:1px solid var(--editorial-line)}
:is(#summary,#shards) .overview-header{display:flex;flex-direction:column;padding:0 0 28px}
:is(#summary,#shards) .overview-header>.hero{order:2;display:block;width:100%;padding:0}
:is(#summary,#shards) .overview-header>.period-picker{order:1;width:100%;padding:0;margin:0 0 16px}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>small{font-size:12px;color:var(--editorial-muted);font-weight:400;display:block;margin-bottom:12px}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>.total{font-size:var(--mh-total-size);line-height:1.15;letter-spacing:-1.5px;font-weight:var(--mh-total-weight);color:var(--editorial-ink);margin:0 0 24px;text-align:left;background:none}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total) .total .quantity-number{font-size:inherit;font-weight:inherit;color:inherit;min-width:0;overflow-wrap:anywhere}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total) .total .quantity-unit{font-size:14px;color:var(--editorial-muted);font-weight:400;letter-spacing:0;margin-left:0}
:is(#summary,#shards) :is(h3,h4){color:var(--editorial-ink);font-size:17px;font-weight:600;line-height:1.5;margin:0 0 12px;letter-spacing:-.3px}
:is(#summary,#shards) h3:before{display:none}
:is(#summary,#shards) .heading-total{font-size:12px;color:var(--editorial-muted);font-weight:400;white-space:nowrap}
:is(#summary,#shards) .heading-total .quantity-number{font-size:15px;font-weight:600;color:var(--editorial-ink)}
:is(#summary,#shards) :is(.summary-section-head,.heading-with-total){gap:8px;align-items:center}
:is(#summary,#shards) .summary-section-head h3{flex:1}
:is(#summary,#shards) :is(button,input,select){border-radius:6px;min-height:44px}
:is(#summary,#shards) button{background:#fff;border:1px solid #E3E4E5;color:var(--editorial-ink);font-weight:500}
:is(#summary,#shards) :is(input,select){min-height:46px;background:#fff;border-color:#DCDDDF;font-size:16px}
:is(#summary,#shards) label{color:var(--editorial-muted);font-size:12px}
:is(#summary,#shards) :is(small,.muted){color:var(--editorial-muted)}
:is(#summary,#shards) :is(.total-breakdown,.candy-totals-table,.slot-totals-table,.graph-detail-table){min-width:0;width:100%;table-layout:fixed;font-size:14px;font-variant-numeric:tabular-nums}
:is(#summary,#shards) :is(.total-breakdown,.candy-totals-table,.slot-totals-table,.graph-detail-table) :is(th,td){background:none;border:0;border-bottom:1px solid var(--editorial-line);text-align:right;padding:12px 4px;color:var(--editorial-ink)}
:is(#summary,#shards) :is(.total-breakdown,.candy-totals-table,.slot-totals-table,.graph-detail-table) th:first-child{text-align:left;padding-left:0;overflow-wrap:anywhere}
:is(#summary,#shards) :is(.total-breakdown,.graph-detail-table) th:first-child{width:44%}
:is(#summary,#shards) :is(.total-breakdown,.graph-detail-table) :is(th,td):nth-child(2){width:20%}
:is(#summary,#shards) :is(.total-breakdown,.graph-detail-table) :is(th,td):nth-child(3){width:36%}
:is(#summary,#shards) :is(.total-breakdown,.candy-totals-table,.slot-totals-table,.graph-detail-table) thead th{font-size:11px;color:var(--editorial-muted);font-weight:400;padding-top:0;padding-bottom:10px}
:is(#summary,#shards) :is(.total-breakdown,.graph-detail-table) .quantity-number{font-size:15px;font-weight:600}
:is(#summary,#shards) .quantity-unit{font-size:11px;font-weight:400;color:var(--editorial-muted)}
:is(#summary,#shards) :is(.candy-table-unit,.weekly-range,.calendar-month){font-size:12px;color:var(--editorial-muted);font-weight:400;line-height:1.7}
:is(#summary,#shards) .candy-totals-table td.candy-table-total{font-size:16px;font-weight:650;color:var(--editorial-ink)}
:is(#summary,#shards) .candy-totals-table td{font-size:13px;color:var(--editorial-muted);white-space:nowrap}
:is(#summary,#shards) .candy-totals-table tbody th{font-size:13px;font-weight:500}
:is(#summary,#shards) .candy-totals-table thead th{background:white}
:is(#summary,#shards) .source-totals{margin:12px 0 20px;display:flex;flex-wrap:wrap;gap:8px 18px;border:0;padding:0;background:none}
:is(#summary,#shards) .source-total-row{padding:0;border:0;gap:6px;font-size:12px;display:flex;align-items:baseline}
:is(#summary,#shards) .source-total-row .quantity-number{font-size:13px;font-weight:500}
:is(#summary,#shards) .candy-chart-legend,:is(#summary,#shards) :is(#candy-month-legend,#shard-month-legend){display:flex;flex-wrap:wrap;gap:8px 16px;font-size:11px;color:var(--editorial-muted);margin:18px 0 24px}
:is(#summary,#shards) :is(.candy-chart-legend,#candy-month-legend,#shard-month-legend)>span{display:flex;gap:6px;align-items:center}
:is(#summary,#shards) :is(.candy-chart-legend,#candy-month-legend,#shard-month-legend) i,:is(#summary,#shards) .source-dot{display:inline-block;width:5px;height:5px;border-radius:50%;flex:none;margin-right:2px}
:is(#summary,#shards) .graph-detail{border-top:1px solid var(--editorial-line);padding-top:18px;margin-top:20px;scroll-margin-bottom:calc(84px + env(safe-area-inset-bottom));scroll-margin-top:16px}
:is(#summary,#shards) .graph-detail-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:16px}
:is(#summary,#shards) .graph-detail h4{font-size:14px;margin:0;font-weight:600}
:is(#summary,#shards) .detail-total{font-size:26px;letter-spacing:-.7px;font-weight:600;white-space:nowrap}
:is(#summary,#shards) .detail-total .quantity-number{font-size:inherit;font-weight:inherit}
:is(#summary,#shards) .detail-total .quantity-unit{font-size:12px;letter-spacing:0}
:is(#summary,#shards) .day-summary-link{width:100%;border:0;border-radius:0;background:none;color:var(--editorial-muted);text-align:right;font-size:12px;padding:12px 0 0}
:is(#summary,#shards) .graph-empty-note{font-size:12px;color:var(--editorial-muted)}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar){gap:4px;margin-top:20px;font-variant-numeric:tabular-nums}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .weekday{font-size:11px;color:#8A9194;padding:0 0 8px}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day{border:0;border-radius:7px;min-height:62px;padding:9px 2px;gap:9px;align-items:center;justify-content:center;background:var(--heat-0);position:relative}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[data-level="1"],:is(#summary,#shards) .heat-key [data-level="1"]{background:var(--heat-1)}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[data-level="2"],:is(#summary,#shards) .heat-key [data-level="2"]{background:var(--heat-2)}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[data-level="3"],:is(#summary,#shards) .heat-key [data-level="3"]{background:var(--heat-3)}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[data-level="4"],:is(#summary,#shards) .heat-key [data-level="4"]{background:var(--heat-4)}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[aria-pressed=true]{box-shadow:inset 0 0 0 1.5px #434E46}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day-number{font-size:11px;font-weight:400;color:#68736C;line-height:1.2}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day-total{font-size:14px;font-weight:600;color:#26332A;line-height:1.3;white-space:nowrap;letter-spacing:-.3px}
:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day[data-level="0"] .day-total{font-weight:400;color:#A0A8A3}
:is(#summary,#shards) .heat-key{display:flex;align-items:center;justify-content:flex-end;gap:5px;margin:16px 0 24px;font-size:10px;color:#888F8B}
:is(#summary,#shards) .heat-key i{width:12px;height:12px;border-radius:3px;background:var(--heat-0)}
:is(#summary,#shards) #analysis :is(.analysis-slot,.analysis-position-block){background:none;box-shadow:none;border:0;border-radius:0;padding:20px 0}
:is(#summary,#shards) #analysis :is(th,td){border-color:var(--editorial-line);background:transparent}
:is(#summary,#shards) #analysis :is(h4,h5){color:var(--editorial-ink)}
:is(#summary,#shards) #analysis .all-row{background:var(--editorial-soft)}
:is(#summary,#shards) #analysis .all-row strong{color:var(--editorial-ink)}
/* ナビは既存6タブの名称・順番・クリック処理を維持。 */
body .tabs,body:has(#record[hidden]) .tabs{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));max-width:840px;background:#fffffff5;backdrop-filter:blur(16px);border-top:1px solid var(--editorial-line);gap:0;padding:6px 10px calc(10px + env(safe-area-inset-bottom));z-index:30}
body .tabs button,body:has(#record[hidden]) .tabs button{font-size:12px;font-weight:400;line-height:1.4;min-height:52px;padding:6px 0;position:relative;background:transparent;border:0;border-radius:0;color:#8B9094}
body .tabs [aria-current=page],body:has(#record[hidden]) .tabs [aria-current=page]{color:var(--editorial-ink);font-weight:650;background:none;border:0}
body .tabs [aria-current=page]:before{content:'';position:absolute;top:0;left:calc(50% - 8px);width:16px;height:2px;background:#222}
@media(min-width:800px){body:has(:is(#record,#sleep,#summary,#shards,#team,#history,#settings):not([hidden])) .app{padding-inline:24px}:is(#summary,#shards) :is(#candy-calendar,#shard-calendar){gap:8px}:is(#summary,#shards) :is(#candy-calendar,#shard-calendar) .day{min-height:76px}}
:is(#summary,#shards) :is(#summary-total,#shard-total){display:block;padding:0}
:is(#summary,#shards) .overview-header>.custom-range.period-picker{display:block}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>.total{width:100%;align-self:stretch;justify-self:start}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>.total:before{content:none}
:is(#summary,#shards) .day-summary-link:not(:disabled){background:none;color:var(--editorial-muted);border:0}
:is(#summary,#shards) :is(.candy-chart-legend,#candy-month-legend,#shard-month-legend) strong{font-size:12px;font-weight:500;color:var(--editorial-ink);font-variant-numeric:tabular-nums}
:is(#summary,#shards) :is(.candy-chart-legend,#candy-month-legend,#shard-month-legend) strong .quantity-number{font-size:inherit;font-weight:inherit}
:is(#summary,#shards) :is(.candy-chart-legend,#candy-month-legend,#shard-month-legend) .quantity-unit{font-size:10px}
:is(#summary,#shards) #analysis .mew-position{border-color:var(--editorial-line);padding-block:20px}
:is(#summary,#shards) #analysis :is(.mew-all th,caption,.mew-cell-amount){color:var(--editorial-ink)}
/* 期間／日時パネル。すべての編集パネルと同じ入力・操作規則。 */
:is(.record-picker[aria-labelledby="datetime-picker-title"],#period-range-dialog){background:#fff;color:var(--editorial-ink);border:0;border-radius:12px;padding:24px;--edge:#DCDDDF;--accent:#555}
:is(.record-picker[aria-labelledby="datetime-picker-title"],#period-range-dialog) h2{color:var(--editorial-ink);font-size:20px}
:is(.record-picker[aria-labelledby="datetime-picker-title"],#period-range-dialog) :is(input,select){border:1px solid #DCDDDF;border-radius:6px;background:#fff;min-height:46px;font-size:16px;color:var(--editorial-ink)}
:is(.record-picker[aria-labelledby="datetime-picker-title"],#period-range-dialog) button{border:0;border-radius:6px;background:var(--editorial-soft);min-height:44px;color:var(--editorial-ink)}
.record-picker[aria-labelledby="datetime-picker-title"] .record-picker-grid button[aria-pressed=true]{background:#25272A;color:#fff;border:0;border-radius:50%}
:is(.record-picker[aria-labelledby="datetime-picker-title"],#period-range-dialog) button[type=submit]{background:#25272A;color:#fff;border-color:transparent}

/* 採用済みカプセル型。曲線・種類切り替えは設けない。 */
.capsule-visual{position:relative;isolation:isolate;max-width:560px;margin:auto}
.capsule-grid{position:absolute;top:20px;left:0;right:0;height:164px;display:flex;flex-direction:column;justify-content:space-between;pointer-events:none;z-index:-1}
.capsule-grid i{display:block;border-top:1px dashed #ECEFEE;width:100%}
.capsule-columns{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:3px}
:is(#summary,#shards) #candy-weekly-chart .capsule-day{display:flex;flex-direction:column;align-items:center;min-width:0;width:100%;padding:0 0 12px;min-height:44px;border:0;border-radius:8px;position:relative;background:transparent;font-variant-numeric:tabular-nums}
:is(#summary,#shards) #candy-weekly-chart .capsule-day[aria-pressed=true]{background:#F5F6F6}
:is(#summary,#shards) #candy-weekly-chart .capsule-day:hover{background:#F8F9F9}
:is(#summary,#shards) #candy-weekly-chart .capsule-day:active{background:#EFF1F1;transform:none}
:is(#summary,#shards) #candy-weekly-chart .capsule-day:focus-visible{outline:2px solid #62696D;outline-offset:1px}
.capsule-track{height:184px;width:100%;position:relative;display:flex;align-items:flex-end;justify-content:center}
.capsule-stack-group{display:block;position:relative;width:23px;max-width:65%;flex:none}
.capsule-stack{display:flex;flex-direction:column-reverse;overflow:hidden;position:absolute;inset:0;border-radius:999px}
.capsule-segment{display:flex;align-items:center;justify-content:center;flex:none;font-size:10px;line-height:1;color:#fff;font-weight:500;font-variant-numeric:tabular-nums}
.capsule-total{position:absolute;left:50%;bottom:100%;transform:translateX(-50%);padding-bottom:8px;font-size:14px;font-weight:650;line-height:1.4;color:#252A2C;white-space:nowrap}
.capsule-total.zero{color:#A0A7A3;font-weight:400}
.capsule-zero{display:block;width:12px;height:2px;border-radius:4px;background:#D9DEDB;margin:auto;transform:translateY(-1px)}
.capsule-weekday{font-size:12px;font-weight:400;line-height:1.5;color:#61696D;margin-top:14px}
.capsule-date{font-size:10px;font-weight:400;color:#969DA0;line-height:1.5;margin-top:2px}
.capsule-empty{font-size:12px;color:#91989A;margin:16px 0 0}
:is(#summary,#shards) #candy-weekly-chart{display:block;margin-top:24px}
:is(#summary,#shards) .candy-day-popover{--popover-safe-top:env(safe-area-inset-top,0px);position:fixed;z-index:45;box-sizing:border-box;padding:16px 14px 6px;margin:0;width:252px;max-width:calc(100vw - 32px);overflow-y:auto;background:#fff;border:1px solid var(--editorial-line);border-radius:12px;box-shadow:0 5px 24px #20212412;scroll-margin:0;overscroll-behavior:contain}
:is(#summary,#shards) .candy-day-popover .graph-detail-head{gap:8px;margin:0 24px 10px 0}
:is(#summary,#shards) .candy-day-popover h4{font-size:13px;white-space:nowrap;margin:0}
:is(#summary,#shards) .candy-day-popover .detail-total{font-size:20px;letter-spacing:-.4px}
:is(#summary,#shards) .candy-day-popover .detail-total .quantity-unit{font-size:10px}
:is(#summary,#shards) .candy-day-popover .graph-detail-table{font-size:12px}
:is(#summary,#shards) .candy-day-popover .graph-detail-table :is(th,td){padding:6px 1px;border:0;font-weight:400}
:is(#summary,#shards) .candy-day-popover .graph-detail-table th:first-child{width:53%;font-size:12px;color:var(--editorial-muted)}
:is(#summary,#shards) .candy-day-popover .graph-detail-table :is(th,td):nth-child(2){width:18%;font-size:11px;color:var(--editorial-muted)}
:is(#summary,#shards) .candy-day-popover .graph-detail-table :is(th,td):nth-child(3){width:29%}
:is(#summary,#shards) .candy-day-popover .graph-detail-table thead{display:none}
:is(#summary,#shards) .candy-day-popover .graph-detail-table .quantity-number{font-size:13px;font-weight:500}
:is(#summary,#shards) .candy-day-popover .graph-detail-table td:nth-child(2) .quantity-number{font-size:11px;font-weight:400}
:is(#summary,#shards) .candy-day-popover .graph-empty-note{margin:6px 0;font-size:11px}
:is(#summary,#shards) .candy-day-popover .day-summary-link{min-height:44px;padding:8px 0 0;font-size:11px;border-top:1px solid var(--editorial-line)}
:is(#summary,#shards) .candy-day-popover .graph-popover-close{position:absolute;top:0;right:0;width:44px;height:44px;padding:0;border:0;background:none;border-radius:6px;color:#8A9093;font-size:20px;font-weight:400}
@media(min-width:800px){.capsule-stack-group{width:27px}.capsule-columns{gap:8px}.capsule-total{font-size:16px}}

/* 管理・履歴・設定の面と操作。記録タブの密度・直接記録は上書きしない。 */
:is(#team,#history,#settings){--accent:#555;--edge:var(--editorial-line);--tint:var(--editorial-soft);color:var(--editorial-ink)}
:is(#team,#history,#settings) :is(.help,.mew,.delibird,.shards){--accent:#555;--edge:var(--editorial-line);--tint:var(--editorial-soft);color:var(--editorial-ink)}
:is(#team,#history,#settings) :is(.card,.hero){border:0;border-radius:0;box-shadow:none;background:transparent;padding:0;margin:0 0 var(--editorial-section);min-width:0}
:is(#team,#history,#settings) :is(h2,h3,h4){color:var(--editorial-ink);font-size:17px;font-weight:600;line-height:1.5;letter-spacing:-.3px}
:is(#team,#history,#settings) :is(p,label){font-size:14px;line-height:1.6}
:is(#team,#history,#settings) :is(small,.muted,label){color:var(--editorial-muted)}
:is(#team,#history,#settings) :is(button,input,select){border-radius:var(--editorial-radius)}
:is(#team,#history,#settings) button{min-height:44px;min-width:44px;font-size:14px;font-weight:500;border:1px solid var(--editorial-input-line);background:#fff;color:var(--editorial-ink)}
:is(#team,#history,#settings) button:active:not(:disabled){background:#ECEEEF}
:is(#team,#history,#settings) button:disabled{background:var(--editorial-soft);border-color:var(--editorial-line);color:#8B9094}
:is(#team,#history,#settings) :is(input:not([type=checkbox]),select){font-size:16px;min-height:46px;background:white;color:var(--editorial-ink);border-color:var(--editorial-input-line)}
:is(#team,#history,#settings) .formatted-date-field{height:46px;background:white;color:var(--editorial-ink);border-color:var(--editorial-input-line);border-radius:var(--editorial-radius)}
:is(#team,#history,#settings) input::placeholder{color:#858B90}
:is(#team,#history,#settings) :is(button,input,select):focus-visible,dialog :is(button,input,select):focus-visible{outline:2px solid #62696D;outline-offset:2px}
:is(#team,#history,#settings) button[type=submit],#team #add-pokemon,#settings #export{min-height:46px;background:#25272A;color:#fff;border-color:transparent}
:is(#team,#settings) button[type=submit]:active,#team #add-pokemon:active,#settings #export:active{background:#414548}
#team #add-pokemon:disabled{background:var(--editorial-soft);color:#8B9094}
:is(#team,#history,#settings) .quantity-number{color:var(--editorial-ink);font-variant-numeric:tabular-nums}
:is(#team,#history,#settings) .quantity-unit{color:var(--editorial-muted);font-weight:400}
/* 同じ期間操作を集計と履歴で共用。 */
/* かけら：大きな合計・同じ3列・区分色は保持。 */
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>.total{white-space:normal;overflow-wrap:anywhere}
:is(#summary,#shards) .overview-header :is(#summary-total,#shard-total)>.total>.quantity{display:inline-flex;align-items:baseline;gap:6px;max-width:100%}
#shards .overview-header #shard-total>small{color:var(--editorial-muted)}
#shards .overview-header .total-breakdown .shard-member :is(th,.quantity-number){color:var(--editorial-muted);font-size:13px;font-weight:400}
#shards .weekly-bars{gap:5px;margin:20px 0}
#shards .weekly-track{height:150px;border:0;background:linear-gradient(to top,transparent calc(50% - .5px),var(--editorial-line) 50%,transparent calc(50% + .5px));border-bottom:1px solid var(--editorial-line)}
#shards #shard-weekly-chart .weekly-bar{width:23px;max-width:70%;border-radius:999px;overflow:hidden}
#shards #shard-weekly-chart .weekly-value{color:var(--editorial-ink);font-size:12px;font-weight:600;min-height:24px}
#shards .weekly-weekday{font-size:12px;color:var(--editorial-muted)}
#shards .shard-chart-legend,#shards #shard-month-legend{display:flex;flex-wrap:wrap;gap:8px 16px;font-size:12px;color:var(--editorial-muted);margin:16px 0 24px}
#shards .shard-chart-legend i{width:6px;height:6px;border-radius:50%}
#shards .source-totals .quantity-number{font-size:13px;font-weight:500}
#shards .resource-calendar .day{border:0;background:var(--editorial-soft);border-radius:6px;padding:8px 2px;min-height:62px}
#shards .resource-calendar .day.selected{background:#FBF4E4;outline:1px solid var(--editorial-shard);outline-offset:-1px}
#shards .resource-calendar .day-number{font-size:11px;font-weight:400;color:var(--editorial-muted)}
#shards .resource-calendar .candy-values{border:0;background:none;padding:0;border-radius:0}
#shards .resource-calendar .month-value{font-size:11px}
/* 編成：枠番号・名前・スキルの一覧と、控えめな切り替え。 */
#team #team-slots>.team-slot-row,#team #team-slots>.team-slot-row.leader-slot{color:var(--editorial-muted);border-bottom:1px solid var(--editorial-line)!important;background:none;border-radius:0;box-shadow:none;padding:12px 0}
#team .team-slot-button{border:0;background:var(--editorial-soft);font-weight:600;text-align:left;padding:10px 12px}
#team .pokemon-nickname{font-weight:400;color:var(--editorial-muted)}
#team .main-skill-label{font-size:12px;color:var(--editorial-muted);padding:0 12px}
#team .registered-row{border-color:var(--editorial-line);flex-wrap:nowrap;align-items:center;padding:14px 0}
#team .registered-info{flex:1;min-width:0}
#team .registered-info>strong{font-size:15px;font-weight:600;overflow-wrap:anywhere;color:var(--editorial-ink)}
#team .registered-info>small{display:block;font-size:12px;margin-top:4px}
#team .row-actions{flex-shrink:0}
#team .row-actions button{background:none;border:0;font-size:13px;font-weight:500}
#team :is(#profile-species,#registration-fields>p){font-size:20px;color:var(--editorial-ink);font-weight:600}
#team .catalog{gap:0;grid-template-columns:1fr;padding:0}
#team .catalog button{border:0;border-bottom:1px solid var(--editorial-line);border-radius:0;font-size:15px;padding:12px 0}
#team .danger,#history #history-list .history-footer .history-actions button.danger{color:var(--editorial-danger)}
/* 履歴：2列の白い一覧。取得内容・数量を先に、日時・方法・個体は補助。 */
#history #history-list{gap:10px;align-items:start}
#history #history-list .card{background:#fff;box-shadow:none;border:0;border-bottom:1px solid var(--editorial-line);border-radius:0;padding:12px 0 0;margin:0}
#history #history-list .card.shards{background:#fff;border-color:var(--editorial-line)}
#history #history-list .history-date-divider{grid-column:1/-1;font-size:14px;font-weight:600;color:var(--editorial-ink);padding:12px 0 6px;margin:0;border-bottom:1px solid var(--editorial-line)}
#history #history-list .history-date-divider:first-child{padding-top:0}
#history .history-head .history-time{color:var(--editorial-muted);font-size:12px}
#history .history-head .history-method{font-size:13px;font-weight:600;color:var(--editorial-candy)}
#history .card.shards .history-head .history-method{color:var(--editorial-shard)}
#history .card.help .history-head .history-method{color:#276242}
#history .card.mew .history-head .history-method{color:#963b68}
#history .card.delibird .history-head .history-method{color:#ad3d39}
#history #history-list .card>.history-target{color:var(--editorial-muted);font-size:13px;margin:0;line-height:1.5}
#history .history-primary{color:var(--editorial-ink);font-size:13px}
#history .history-footer{border-color:#2021240D;margin-top:8px}
#history #history-list .history-footer>.history-detail-button,#history #history-list .history-footer .history-actions button{border:0;background:none;color:var(--editorial-ink);font-weight:500;font-size:12px;min-height:44px}
/* 設定：グループ単位の余白。各行はラベルとスイッチだけ。 */
#settings-settings-panel>.card{border-top:1px solid var(--editorial-line);padding:24px 0;margin:0}
#settings-settings-panel>.record-display-settings{border-top:0;padding-top:0}
#settings .card>h3{border:0;margin:0 0 8px;padding:0;font-size:17px;color:var(--editorial-ink)}
#settings .settings-intro{color:var(--editorial-muted);font-size:12px;line-height:1.7;margin:0 0 16px}
#settings .settings-group h4{font-size:13px;color:var(--editorial-candy);margin-bottom:4px}
#settings .settings-group+.settings-group h4{color:var(--editorial-shard)}
#settings .setting-row{border-color:var(--editorial-line);font-size:15px;min-height:48px;color:var(--editorial-ink)}
#settings .setting-control input{background:#E6E8E9;border-color:#E6E8E9}
#settings .setting-control input:checked{background:#343638;border-color:#343638}
#settings .setting-control input:focus-visible{outline-color:#62696D}
#settings .setting-state,#settings input:checked+.setting-state::after{color:var(--editorial-muted)}
#settings #restore-backup{background:var(--editorial-soft);color:var(--editorial-ink);border-color:transparent}
#settings .backup-actions button{font-size:15px;min-height:48px;border-radius:6px}
/* すべてのネイティブダイアログ：寸法・スクロール・保存動作は維持。 */
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel){--accent:#555;--edge:var(--editorial-input-line);--tint:var(--editorial-soft);background:#fff;color:var(--editorial-ink);border:1px solid var(--editorial-line);border-radius:12px;padding:20px;box-shadow:0 8px 32px #20212414}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel)::backdrop{background:#20212455}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) :is(h2,h3){color:var(--editorial-ink);font-size:20px;font-weight:600}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) :is(p,label,small){color:var(--editorial-muted);line-height:1.6}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) :is(input:not([type=checkbox]),select){font-size:16px;min-height:46px;border-radius:6px;background:white;color:var(--editorial-ink);border-color:var(--editorial-input-line)}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) input[type=checkbox]{accent-color:#343638}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) button{min-height:44px;border-radius:6px;border-color:var(--editorial-input-line);background:var(--editorial-soft);color:var(--editorial-ink);font-weight:500}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) button[type=submit]{background:#25272A;color:#fff;border-color:transparent;min-height:46px}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) .error,body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) [role=alert],#edit-error,#team-picker-error{color:var(--editorial-danger)}
body .period-picker-dialog [aria-pressed=true]{background:#25272A;color:white;border-color:transparent}
#history-edit-form>.section-head{background:white}
body #team-picker{background:white;color:var(--editorial-ink);border-color:var(--editorial-line);padding:0;border-radius:12px}
#team-picker .team-picker-header{background:white;border-color:var(--editorial-line)}
#team-picker h2{color:var(--editorial-ink)}
#team-picker :is(label,#team-picker-context,.team-picker-status){color:var(--editorial-muted)}
#team-picker .team-picker-row{border-color:var(--editorial-line);color:var(--editorial-ink);font-size:15px}
#team-picker .team-picker-row[aria-pressed=true]{background:var(--editorial-soft);color:var(--editorial-ink)}
#team-picker .team-picker-row[aria-pressed=true] .team-picker-status{color:var(--editorial-ink)}
body #history-details-panel{background:white;color:var(--editorial-ink);border-color:var(--editorial-line);padding:0;border-radius:12px 12px 0 0}
#history-details-panel .history-detail-heading{background:var(--detail-bg);border-color:var(--editorial-line)}
#history-details-panel h2,#history-details-panel h3{color:var(--editorial-ink)}
#history-details-panel .history-detail-heading button{background:white;border-color:transparent;color:var(--editorial-ink);border-radius:6px}
#history-details-panel section+section{border-color:var(--editorial-line)}
#history-details-panel .history-detail-row>span,#history-details-panel small{color:var(--editorial-muted)}
@media(prefers-reduced-motion:reduce){body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel){scroll-behavior:auto}}

#team-picker :is(button,input):focus-visible{outline:2px solid #62696D;outline-offset:2px}
body #history-details-panel h3{font-size:13px;font-weight:600}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) :is(.record-picker-grid,.period-picker-choices) button[aria-pressed=true]{background:#25272A;color:#fff;border-color:transparent}
body :is(dialog,#history-editor,#shard-editor,#team-picker,#history-details-panel) .record-picker-grid button[aria-pressed=true]{border-radius:50%}
#history .history-head .history-time{flex:1;max-width:58%;min-width:0;white-space:normal}
#history .history-head .history-method{flex:0 0 auto;max-width:48%}
:is(#team,#history,#settings) button.danger{color:var(--editorial-danger)}
#settings .setting-state{font-size:12px}

/* 一時通知は固定の白いフローティング面。カテゴリ色は小さいチェックに限定。 */
/* 名前はセル幅いっぱいの最大2行、個数は独立した行で省略しない。 */
#history #history-list{column-gap:16px;row-gap:12px}
#history .history-meta{display:flex;flex-direction:column;align-items:flex-start;gap:4px;margin:0 0 8px}
#history .history-meta .history-primary{flex:none;width:100%;min-height:20px;font-size:14px;font-weight:600;line-height:20px;white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis}
#history .history-meta .history-amount{font-size:22px;font-weight:650;line-height:1.2;max-width:100%;white-space:nowrap}
#history .history-meta .history-amount .quantity-number{font-size:clamp(16px,12cqi,22px);font-weight:650}
#history .history-meta .history-amount .quantity-unit{font-size:11px;font-weight:400;margin-left:3px}
#history .history-head{margin:0 0 4px;gap:6px;align-items:baseline}
#history .history-head .history-method{font-size:12px;font-weight:500}
#history .history-head .history-time{font-size:12px;line-height:1.5}
#history #history-list .card>.history-target{font-size:12px;line-height:18px;color:var(--editorial-muted);margin:0;min-height:18px}

/* 編成・登録済み：ニックネームを主情報にした白い2列一覧。 */
#team :is(#team-slots,#registered-pokemon-list){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:16px;row-gap:0;align-items:stretch}
#team #team-slots>.team-slot-row,#team #team-slots>.team-slot-row.leader-slot{grid-template-columns:minmax(0,1fr);gap:4px;align-content:start;padding:12px 0;min-width:0}
#team .team-slot-row>span,#team .individual-number{font-size:11px;font-weight:400;line-height:18px;color:var(--editorial-muted)}
#team .team-slot-button{min-width:0;min-height:60px;padding:6px 0;background:#fff;border:0;border-radius:0;text-align:left}
#team .team-slot-button:hover{background:var(--editorial-soft)}
#team .team-slot-button:active{background:#ECEEEF}
#team .team-individual-name{display:block;min-width:0;max-width:100%;text-align:left}
#team .team-individual-name>strong{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere;font-size:16px;font-weight:650;line-height:24px;color:var(--editorial-ink)}
#team .team-individual-name>small{display:block;font-size:12px;font-weight:400;line-height:18px;color:var(--editorial-muted);margin-top:2px;overflow-wrap:anywhere}
#team #registered-pokemon-list .registered-row{display:flex;flex-direction:column;align-items:stretch;gap:8px;min-width:0;padding:12px 0;border-bottom:1px solid var(--editorial-line)}
#team .registered-info{flex:1;min-width:0;gap:4px}
#team #registered-pokemon-list .row-actions{margin:0;align-self:flex-end;gap:4px;flex-wrap:wrap}
#team #registered-pokemon-list .row-actions button{min-width:44px;min-height:44px;padding:8px 4px}
#team #registered-pokemon-list>p{grid-column:1/-1}

/* 全タブの見出しは上の単一ルール。期間操作は3画面共通。 */
#record #today-total{padding-top:16px}
#record #today-total .record-day-note{display:block;font-size:12px;font-weight:400;line-height:1.5;color:var(--editorial-muted);margin-top:4px}

/* 共有画像は表の下へ挿入せず、元のスクロール位置を保つ閲覧専用パネルへ。 */
body #image-preview-dialog{width:calc(100% - 24px);max-width:780px;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);padding:0;border:1px solid var(--editorial-line);border-radius:8px;overflow:hidden;color:var(--editorial-ink);box-shadow:0 8px 30px #00000018}
#image-preview-dialog::backdrop{background:#0007}
#image-preview-dialog header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 16px;border-bottom:1px solid var(--editorial-line);background:#fff}
#image-preview-dialog header h2{margin:0;font-size:16px;font-weight:600}
#image-preview-dialog header button{flex:none;min-height:44px}
#image-preview-dialog .image-preview-content{overflow-y:auto;overscroll-behavior:contain;max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 105px);padding:0 12px 16px;-webkit-overflow-scrolling:touch}
#image-preview-dialog figure{margin:0 0 16px}
#image-preview-dialog img{display:block;width:100%;height:auto;max-width:none;border:0;border-radius:0;background:white;-webkit-touch-callout:default;user-select:auto}
#image-preview-dialog .image-preview-hint{font-size:13px;line-height:1.6;color:var(--editorial-muted);margin:10px 0}
#image-preview-dialog .image-preview-hint:empty{display:none}
#image-preview-dialog .image-preview-actions{display:flex;gap:12px;margin:8px 0}
#image-preview-dialog .image-preview-actions>*{display:flex;align-items:center;justify-content:center;flex:1;min-height:44px;font-size:14px;font-weight:500;color:var(--editorial-ink);background:var(--editorial-soft);border:0;border-radius:6px;text-decoration:none;padding:0 12px}

/* 日付操作は長いサマリーの外に置き、各タブ内で固定する。 */
#history .history-meta .history-category{order:-1;display:inline-block;align-self:flex-start;font-size:11px;font-weight:500;line-height:18px;padding:0 6px;border-radius:3px;background:var(--editorial-soft);color:var(--editorial-muted)}
#history .card:not(.shards) .history-category{color:var(--editorial-candy)}
#history .card.shards .history-category{color:var(--editorial-shard)}
#shards #shard-weekly-chart .weekly-column{min-width:0;width:100%;padding:6px 0 10px;border:0;background:transparent;color:var(--editorial-ink);border-radius:8px;font-variant-numeric:tabular-nums}
#shards #shard-weekly-chart .weekly-column[aria-pressed=true]{background:var(--editorial-soft)}
#shards #shard-weekly-chart .weekly-column:active{background:#EFF1F1}
#shards .weekly-day-number{font-size:10px;font-weight:400;color:var(--editorial-muted);line-height:1.5}

/* Compact shard totals fit seven columns; day details retain exact values. */
#shards #shard-calendar .day-total{font-size:12px;letter-spacing:-.4px;max-width:100%;white-space:normal;overflow-wrap:anywhere}

/* 3タブの期間操作を同じDOM・同じ寸法で管理する。 */

:root{--page-title-gap:16px;--period-row-gap:8px;--period-control-height:44px;--period-content-gap:16px}
body .app>:is(#record,#sleep,#summary,#shards,#team,#history,#settings)>.editorial-page-title{margin-bottom:var(--page-title-gap)}
:is(#summary,#shards,#history)>.period-picker,:is(#sleep,#sleep-editor) #sleep-root>.period-picker{position:sticky;top:env(safe-area-inset-top,0px);z-index:20;background:#fffffff5;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);padding:8px 0 0;margin:0 0 var(--period-content-gap);border:0;border-radius:0;box-shadow:none;width:100%;min-width:0}
:is(#summary,#shards,#history,#sleep,#sleep-editor) .period-picker .period-picker-top{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:0;width:100%;max-width:none;margin:0}
:is(#summary,#shards,#history,#sleep,#sleep-editor) .period-picker .period-picker-top>:is(button,.period-picker-day){min-height:var(--period-control-height);height:auto;margin:0;padding:8px 4px;border:0;border-radius:6px;background:none;color:var(--editorial-ink);font-size:20px;font-weight:400;line-height:1.5}
:is(#summary,#shards,#history,#sleep,#sleep-editor) .period-picker .period-picker-top>.period-picker-date{font-size:16px;font-weight:600;white-space:normal;overflow-wrap:anywhere;line-height:1.5;letter-spacing:0;font-variant-numeric:tabular-nums}
:is(#summary,#shards,#history) .period-picker .period-quick-buttons,
:is(#sleep,#sleep-editor) .sleep-switch,#team .team-switch{display:flex;align-items:center;gap:4px;margin:var(--period-row-gap) 0 0;padding:0;border-bottom:1px solid var(--editorial-line);justify-content:flex-start;background:none;border-radius:0;box-shadow:none}
:is(#summary,#shards,#history) .period-picker .period-quick-buttons>button,
:is(#sleep,#sleep-editor) .sleep-switch>button,#team .team-switch>button{position:relative;box-shadow:none;min-width:44px;min-height:var(--period-control-height);margin:0;padding:10px 12px;border:0;border-radius:0;background:none;color:var(--editorial-muted);font-size:13px;font-weight:400;line-height:1.5;white-space:nowrap}
:is(#summary,#shards,#history) .period-picker .period-quick-buttons>button:last-child{margin-left:auto}
:is(#summary,#shards,#history) .period-picker .period-quick-buttons>button[aria-pressed=true],
:is(#sleep,#sleep-editor) .sleep-switch>button[aria-pressed=true],#team .team-switch>button[aria-selected=true]{background:none;box-shadow:none;color:var(--editorial-ink);font-weight:600}
:is(#summary,#shards,#history) .period-picker .period-quick-buttons>button[aria-pressed=true]::after,
:is(#sleep,#sleep-editor) .sleep-switch>button[aria-pressed=true]::after,#team .team-switch>button[aria-selected=true]::after{content:'';position:absolute;bottom:-1px;left:12px;right:12px;height:2px;background:var(--editorial-ink)}

#settings #research-rank-form{grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:12px}
#settings #research-rank-form label{display:flex;flex-direction:column;gap:6px;margin:0;min-width:0}
#settings #research-rank-form :is(input,button){box-sizing:border-box;height:48px;min-height:48px;margin:0}
#settings #research-rank-setting{font-size:16px;font-weight:650;text-align:center;font-variant-numeric:tabular-nums}
#settings #data-sources .source-entry{padding:14px 0;border-bottom:1px solid var(--editorial-line)}
#settings #data-sources h4{margin:0 0 6px;font-size:14px;line-height:1.6;font-weight:600}
#settings #data-sources a{color:var(--editorial-ink);text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
#settings #data-sources p{margin:6px 0 0;font-size:13px;line-height:1.7;color:var(--editorial-muted);overflow-wrap:anywhere}
#settings #data-sources .source-url{font-size:12px}
#settings #mit-license{margin-top:16px;border:0;border-radius:0;background:none;padding:0}
#settings #mit-license summary{min-height:44px;padding:10px 0;font-size:14px;font-weight:500}
#settings #mit-license pre{font:12px/1.7 ui-monospace,monospace;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--editorial-ink);margin:12px 0}

:is(#summary,#shards) .summary-section-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}
:is(#summary,#shards) .summary-section-head>h3{min-width:0;margin:0;flex:1;flex-wrap:wrap}
:is(#summary,#shards) :is(.section-image-button,#create-candy-image,#create-mew-image){flex:0 0 60px;box-sizing:border-box;width:60px;min-width:60px;height:var(--mh-control-height);min-height:var(--mh-control-height);background:var(--mh-surface);color:var(--mh-text);border:1px solid var(--mh-border);border-radius:var(--mh-radius);font-family:var(--mh-font);font-size:14px;font-weight:500;line-height:1.5;padding:8px 12px;margin:0}
:is(#summary,#shards) .export-overview-heading{order:1;margin:0 0 12px}
:is(#summary,#shards) .overview-header>.candy-source-switches{order:1;margin:0 0 16px}

/* 画像範囲・更新履歴は同じ閲覧パネルを共用する。 */
.app>header{position:relative}
#app-version{position:absolute;right:0;top:0;min-height:44px;min-width:56px;padding:8px 0;background:none;border:0;color:var(--editorial-muted);font-size:12px;font-weight:400}
.app>header h1{max-width:calc(100% - 64px)}
#app-panel{width:min(540px,calc(100% - 32px));max-height:calc(100dvh - 48px - env(safe-area-inset-top) - env(safe-area-inset-bottom));padding:0;border:1px solid var(--editorial-line);border-radius:10px;color:var(--editorial-ink);background:white;overflow:hidden}
#app-panel::backdrop{background:rgba(0,0,0,.35)}
.app-panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 16px;border-bottom:1px solid var(--editorial-line)}
.app-panel-head h2{margin:0;font-size:18px;font-weight:600}
.app-panel-head button{min-height:44px}
.app-panel-body{padding:16px;overflow-y:auto;max-height:calc(100dvh - 160px - env(safe-area-inset-top) - env(safe-area-inset-bottom));overscroll-behavior:contain}
.panel-muted{font-size:14px;color:var(--editorial-muted);margin:0 0 12px}
.export-scope-option{display:block;width:100%;min-height:48px;text-align:left;margin:8px 0;padding:12px;background:var(--editorial-soft);border:0;border-radius:6px;font-size:15px;white-space:normal}
.release-entry h3{font-size:20px;margin:0 0 6px}.release-entry time{font-size:13px;color:var(--editorial-muted)}
.release-entry ul{padding-left:20px;font-size:15px;line-height:1.7}.release-entry+.release-entry{border-top:1px solid var(--editorial-line);padding-top:20px;margin-top:20px}
#team #registered-pokemon-list>.roster-purpose-heading{grid-column:1/-1;margin:24px 0 0;font-size:15px;line-height:1.5;font-weight:600}
#team .registration-method-heading{font-size:15px;font-weight:600;margin:20px 0 12px}
#team .individual-import-entry{margin-top:24px;border-top:1px solid var(--editorial-line);padding-top:16px}
#record #shard-skill-inputs .shard-fixed-option{display:flex;justify-content:flex-end}
#record #shard-skill-inputs .shard-fixed-option button{min-width:80px;font-size:16px;font-weight:600;padding:8px 12px}

/* 日単位のネイティブ選択も共通の日付行に重ねて操作できる。 */
.period-picker.single-day{border-bottom:1px solid var(--mh-border)!important;padding-bottom:8px!important}.period-picker-day{position:relative;display:flex;align-items:center;justify-content:center;box-sizing:border-box;min-width:0;cursor:pointer}.period-picker-day input[type=date]{position:absolute;inset:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.period-picker-day:focus-within{outline:2px solid var(--mh-accent);outline-offset:-2px}#sleep-editor #sleep-root>.period-picker{position:static}

/* One candy-type table; only this region scrolls. Keep names/totals readable. */
#summary .candy-table-scroll{width:100%;max-width:100%;min-width:0;overflow:auto}
#summary .candy-totals-table :is(th,td):first-child{position:sticky;left:0;width:124px;min-width:124px;box-sizing:border-box;background:var(--mh-surface,#fff);z-index:1}
#summary .candy-totals-table :is(th,td):last-child{width:80px;min-width:80px;background:var(--mh-surface,#fff)}
#summary .candy-totals-table thead th{z-index:2}
#summary .candy-totals-table thead th:first-child{z-index:3}

/* 種類別アメ：設定と共有する対象切り替え・回数と個数の比較。 */
#summary .candy-source-switches{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 12px}
#summary .candy-source-switches button{min-height:44px;padding:6px 10px;font-size:13px;border:1px solid var(--mh-border);border-radius:var(--mh-radius);background:var(--mh-surface);color:var(--mh-muted)}
#summary .candy-source-switches button[aria-pressed=true]{background:var(--mh-selected);color:var(--mh-text);border-color:var(--mh-accent)}
#summary .candy-totals-table .candy-method-count{display:block;font-size:13px;color:var(--mh-muted);line-height:1.5}
#summary .candy-totals-table .candy-method-amount{display:block;font-size:15px;font-weight:500;color:var(--mh-text);line-height:1.5}
#summary .candy-totals-table :is(th,td){padding:8px 6px}

/* 対象切り替えを割合の見出しとして兼用。 */
#summary .candy-source-switches{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
#summary .candy-source-choice{min-width:0;text-align:center}
#summary .candy-source-choice button{width:100%;padding-inline:2px;font-size:12px;white-space:nowrap}
#summary .candy-source-percent{display:block;margin-top:4px;font-size:13px;color:var(--mh-muted)}
@media(max-width:360px){#summary .candy-source-switches{grid-template-columns:repeat(3,minmax(0,1fr))}}
#record #nap-island-shard-form{display:grid;grid-template-columns:minmax(0,1fr) 100px;gap:12px;align-items:end;margin-bottom:24px}
#record #nap-island-shard-form label{margin:0;min-width:0}
#record #nap-island-shard-form input{height:44px;font-size:16px;text-align:center}
#record #nap-island-shard-form button{height:44px;justify-self:end;min-width:64px}
#record-nap-view[hidden]{display:none!important}

[data-tab]{touch-action:manipulation}
.research-fields input::placeholder{color:var(--mh-muted);opacity:.8}

/* 全体の除外は個別フィルターより優先。操作・割合の位置は共通。 */
#summary .candy-filter-excluded{display:block;font-size:10px;line-height:1.5;color:var(--mh-muted)}
#summary .candy-source-switches button[data-excluded=true]{border-style:dashed;color:var(--mh-muted)}

/* 履歴：分類と時刻 → 入手方法 → 個数とアメ名 → 保存時の個体。 */
#history .history-topline{display:flex;justify-content:space-between;align-items:baseline;gap:4px;margin:0 0 4px;min-width:0}
#history .history-topline .history-category{font-size:11px;font-weight:500;line-height:18px;padding:0 6px;border-radius:3px;background:var(--editorial-soft);white-space:nowrap}
#history .history-topline .history-time{font-size:12px;line-height:18px;color:var(--editorial-muted);font-variant-numeric:tabular-nums;white-space:normal;text-align:right;min-width:0}
#history .history-topline .history-time>span{display:inline-block;white-space:nowrap}
#history .history-source .history-method{max-width:100%;text-align:left;white-space:normal;overflow-wrap:anywhere}
#history .history-meta{flex-direction:row;flex-wrap:nowrap;justify-content:flex-start;align-items:baseline;gap:2px 6px;margin:0 0 4px}
#history .history-meta .history-primary{flex:1 1 60px;width:auto;min-width:0;margin:0;display:block;overflow:visible;white-space:normal;overflow-wrap:anywhere}
#history #history-list .card>.history-target{white-space:normal;overflow:visible;overflow-wrap:anywhere;min-height:0}

/* 集計フィルターは設定ONの項目だけ、従来のコンパクトな寸法で並べる。 */
:is(#summary,#shards) .candy-source-switches{display:flex;flex-wrap:wrap;justify-content:flex-start;gap:4px;margin:8px 0 12px}
:is(#summary,#shards) .candy-source-choice{flex:0 0 59px;width:59px;min-width:0;text-align:center}
:is(#summary,#shards) .candy-source-choice button{width:100%;min-height:44px;padding:6px 2px;font-size:12px;white-space:nowrap;border:1px solid var(--mh-border);border-radius:var(--mh-radius);background:var(--mh-surface);color:var(--mh-muted)}
:is(#summary,#shards) .candy-source-choice button[aria-pressed=true]{background:var(--mh-selected);color:var(--mh-text);border-color:var(--mh-accent)}
:is(#summary,#shards) .candy-source-percent{display:block;margin-top:4px;font-size:13px;color:var(--mh-muted)}
#record-shard-date{margin:0 0 16px}
#record-shard-date .period-picker-top{min-height:52px;display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:8px}
#record-shard-date .period-picker-date{position:relative;text-align:center;font-size:16px;font-weight:600;color:var(--mh-text);margin:0}
#record-shard-date input{position:absolute;inset:0;width:100%;height:100%;opacity:0;margin:0}
#record-shard-date button{padding:0;background:none;border:0;min-height:44px}
#record #nap-island-shard-form{border-top:0}
#record .nap-island-card #nap-island-form label{margin:0}
#record .nap-island-card #nap-island-amount{min-width:0}
#record .nap-island-card input::placeholder{color:var(--mh-muted);font-weight:400}
.quantity{vertical-align:baseline}.quantity-unit{font-weight:400}
.candy-totals-table .quantity-number,.sleep-history .quantity-number{font-size:inherit;font-weight:inherit}
.candy-totals-table .quantity-unit,.sleep-history .quantity-unit{font-size:.8em;font-weight:400}
#record #nap-island-section>h2.record-subheading:first-child{border-bottom:0}
#shards .candy-source-choice{flex-basis:auto;width:max-content}
#shards .candy-source-choice button{width:auto;min-width:59px;padding-inline:8px}

/* 週間・月間は項目ボタン、割合、獲得合計を同じ列にまとめる。 */
:is(#summary,#shards) .candy-source-amount{display:block;margin-top:2px;font-size:13px;line-height:1.5;font-variant-numeric:tabular-nums;color:var(--mh-text);overflow-wrap:anywhere}
:is(#summary,#shards) .candy-source-amount .quantity-number{font-size:inherit;font-weight:inherit}
:is(#summary,#shards) .candy-source-amount .quantity-unit{font-size:11px;font-weight:400}
#shards .candy-source-choice{flex:0 0 59px;width:59px}
#shards .candy-source-choice button{width:100%;padding-inline:2px}
:is(#summary,#shards) .candy-source-amount .quantity{white-space:normal}

/* About disclosure reuses the settings and existing source/license disclosures. */
#settings #about-app>summary{font-size:17px;font-weight:600;min-height:44px;line-height:1.5;padding:10px 0;cursor:pointer}
#settings #about-app>summary::marker{color:var(--mh-muted)}
#settings #about-app[open]>summary{margin-bottom:12px}
#settings #about-app>h3,#settings #about-app>.about-contact>h3{margin:16px 0 6px;font-size:14px;line-height:1.6;font-weight:600}
#settings #about-app>p,#settings #about-app>.about-contact>p{margin:6px 0 0;font-size:13px;line-height:1.7;color:var(--editorial-muted);overflow-wrap:anywhere}
#settings #about-app>#data-sources{margin:16px 0;padding:0;border:0;background:none}
#settings #about-app>.about-contact a{color:var(--editorial-ink);text-decoration:underline;text-underline-offset:3px;overflow-wrap:anywhere}
#settings #settings-settings-panel>details.card:not(#about-app)>summary{font-size:17px;font-weight:600;min-height:44px;line-height:1.5;padding:10px 0;cursor:pointer}
#settings #settings-settings-panel>details.card:not(#about-app)>summary::marker{color:var(--mh-muted)}
#settings #settings-settings-panel>details.card:not(#about-app)[open]>summary{margin-bottom:12px}
