/* ==========================================================
   カレンダー & ライフトラッカー  スタイル
   ライト／ダークをトークンで切り替える
   ========================================================== */

:root {
    --bg: #f4f5fa;
    --surface: #ffffff;
    --surface-2: #f1f3f8;
    --surface-3: #e7eaf2;
    --border: #e4e7ef;
    --text: #1c2130;
    --text-2: #6b7385;
    --text-3: #a3aabb;
    --accent: #ff6b5b;
    --accent-rgb: 255, 107, 91;
    --accent-soft: rgba(255, 107, 91, 0.12);
    --sun: #ef4d5e;
    --sat: #3b82f6;
    --high: #1fb573;
    --mid: #f59e0b;
    --low: #ef4d5e;
    --high-rgb: 31, 181, 115;
    --mid-rgb: 245, 158, 11;
    --low-rgb: 239, 77, 94;
    --shadow: 0 4px 24px rgba(20, 30, 60, 0.07);
    --radius: 20px;
    --cell-w: 44px;
    --label-w: 96px;
    --header-bg: rgba(244, 245, 250, 0.85);
    --sheet-bg: #ffffff;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0e1015;
        --surface: #171a21;
        --surface-2: #1f232c;
        --surface-3: #2a2f3a;
        --border: #262b36;
        --text: #eef0f5;
        --text-2: #9aa3b5;
        --text-3: #5f6779;
        --accent: #ff7a6b;
        --accent-rgb: 255, 122, 107;
        --accent-soft: rgba(255, 122, 107, 0.16);
        --sun: #ff6b7a;
        --sat: #60a5fa;
        --high: #34d399;
        --mid: #fbbf24;
        --low: #ff6b7a;
        --high-rgb: 52, 211, 153;
        --mid-rgb: 251, 191, 36;
        --low-rgb: 255, 107, 122;
        --shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
        --header-bg: rgba(14, 16, 21, 0.85);
        --sheet-bg: #171a21;
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0e1015;
    --surface: #171a21;
    --surface-2: #1f232c;
    --surface-3: #2a2f3a;
    --border: #262b36;
    --text: #eef0f5;
    --text-2: #9aa3b5;
    --text-3: #5f6779;
    --accent: #ff7a6b;
    --accent-rgb: 255, 122, 107;
    --accent-soft: rgba(255, 122, 107, 0.16);
    --sun: #ff6b7a;
    --sat: #60a5fa;
    --high: #34d399;
    --mid: #fbbf24;
    --low: #ff6b7a;
    --high-rgb: 52, 211, 153;
    --mid-rgb: 251, 191, 36;
    --low-rgb: 255, 107, 122;
    --shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
    --header-bg: rgba(14, 16, 21, 0.85);
    --sheet-bg: #171a21;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* ページ全体は横にスクロールさせない（スマホで横にぐらつくのを防ぐ） */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
}

html { -webkit-text-size-adjust: 100%; }

/* iOS は 16px 未満の入力欄をタップすると自動で拡大するので、入力欄は必ず 16px 以上にする */
input, textarea, select { font-size: 16px; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

body.no-scroll { overflow: hidden; }

button, input, textarea, select {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; background: none; border: none; }

/* タップできる要素: ダブルタップ拡大の待ち時間をなくし、すぐ反応させる */
[data-action], button, .habit-row {
    cursor: pointer;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

/* ---------- レイアウト ---------- */

.app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.header {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
    background: var(--header-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-mark { display: grid; place-items: center; }
.brand-mark .face { display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: var(--text);
}
.brand-tag {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

.icon-btn {
    width: 40px;
    height: 40px;
    margin-right: -8px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
}
.icon-btn:active { background: var(--surface-2); color: var(--text); }

.month-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2px;
}

.nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    color: var(--text);
    transition: background 0.15s;
}
.nav-btn:active { background: var(--surface-2); }

.month-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.01em;
    padding: 6px 14px;
    border-radius: 12px;
}
.month-title:active { background: var(--surface-2); }

.main {
    flex: 1;
    padding: 14px 16px calc(env(safe-area-inset-bottom) + 32px);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    animation: rise 0.35s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

.card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ---------- 今日カード ---------- */

.today-card {
    position: relative;
    overflow: hidden;
}
.today-card::before {
    content: '';
    position: absolute;
    top: -110px;
    right: -70px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--accent-rgb), 0.26), transparent 66%);
    pointer-events: none;
}
.today-card > * { position: relative; }

.today-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.today-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.today-date {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin-top: 2px;
}

.today-event {
    margin-top: 4px;
    font-size: 13px;
    font-weight: 700;
    color: var(--sun);
}
.today-event.plain { color: var(--accent); }

.today-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}
.today-right .day-nav { gap: 0; margin-right: -8px; }
.today-right .nav-btn { width: 40px; height: 36px; }

.streak {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}
.streak.none { background: var(--surface-2); color: var(--text-2); font-weight: 600; white-space: normal; text-align: right; max-width: 150px; line-height: 1.3; }

.mood-block { margin-top: 18px; }

.mood-status {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.mood-emoji {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    transition: transform 0.2s;
}
.mood-emoji .face { display: block; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.18)); }
.mood-emoji.bump { animation: bump 0.3s ease; }

@keyframes bump {
    0% { transform: scale(1); }
    40% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.mood-status-text { font-size: 15px; font-weight: 700; }
.mood-status-sub { font-size: 12px; color: var(--text-2); font-weight: 600; }

/* 1〜5 と 6〜10 の2段。指で押しやすい大きさにする */
.mood-chips {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.chip {
    height: 76px;
    border-radius: 16px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 13px;
    font-weight: 800;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1.4), background 0.15s, color 0.15s, box-shadow 0.15s;
}
.chip:active { transform: scale(0.9); }
/* 1〜10 が低い→高いへ色づいて見えるように薄く色を敷く */
.chip.t-low { background: rgba(var(--low-rgb), 0.14); color: rgba(var(--low-rgb), 0.95); }
.chip.t-mid { background: rgba(var(--mid-rgb), 0.14); color: rgba(var(--mid-rgb), 0.95); }
.chip.t-high { background: rgba(var(--high-rgb), 0.14); color: rgba(var(--high-rgb), 0.95); }
.chip .face { display: block; transition: transform 0.15s; }
.chip.on .face { transform: scale(1.1); }
.chip.on { color: #fff; transform: translateY(-2px) scale(1.05); }
.chip.on.t-low { background: var(--low); box-shadow: 0 6px 16px rgba(var(--low-rgb), 0.45); }
.chip.on.t-mid { background: var(--mid); box-shadow: 0 6px 16px rgba(var(--mid-rgb), 0.45); }
.chip.on.t-high { background: var(--high); box-shadow: 0 6px 16px rgba(var(--high-rgb), 0.45); }

.habit-block { margin-top: 18px; }

.habit-progress {
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
    margin: 8px 0 10px;
}
.habit-progress > i {
    display: block;
    height: 100%;
    background: var(--high);
    border-radius: 3px;
    transition: width 0.3s ease;
}
.habit-progress.complete > i {
    background: linear-gradient(90deg, var(--high), var(--accent));
    box-shadow: 0 0 12px rgba(var(--high-rgb), 0.5);
}
.card-title .all-done { color: var(--high); }

.habit-list { display: flex; flex-direction: column; gap: 6px; }

.habit-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--surface-2);
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    transition: background 0.15s;
}
.habit-row.done { color: var(--text-2); }
.habit-row.done .habit-name { text-decoration: line-through; text-decoration-color: var(--text-3); }
.habit-row:active { background: var(--surface-3); }
.habit-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.check {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid var(--surface-3);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.check svg { width: 14px; height: 14px; opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.15s; }
.check.on { background: var(--high); border-color: var(--high); }
.check.on svg { opacity: 1; transform: scale(1); }

.memo-block { margin-top: 18px; }

.memo-input {
    width: 100%;
    min-height: 68px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1.5px solid transparent;
    background: var(--surface-2);
    resize: none;
    line-height: 1.5;
    font-size: 16px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.memo-input:focus { border-color: var(--accent); background: var(--surface); }
.memo-input::placeholder { color: var(--text-3); }

.empty-note {
    font-size: 13px;
    color: var(--text-3);
    padding: 8px 0;
}

/* ---------- 月グリッド ---------- */

.grid-card { padding: 18px 0 8px; }
.grid-card .card-title { padding: 0 18px; }

.grid-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
}
.grid-scroll::-webkit-scrollbar { display: none; }

.grid { min-width: max-content; }

.g-row {
    display: flex;
    border-bottom: 1px solid var(--border);
}
.g-row:last-child { border-bottom: none; }

.g-label {
    position: sticky;
    left: 0;
    z-index: 5;
    width: var(--label-w);
    min-width: var(--label-w);
    padding: 0 10px 0 18px;
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    background: var(--surface);
    box-shadow: 6px 0 10px -8px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.g-label span { overflow: hidden; text-overflow: ellipsis; }

.g-cell {
    width: var(--cell-w);
    min-width: var(--cell-w);
    display: grid;
    place-items: center;
    position: relative;
}
.g-cell.sat { background: rgba(59, 130, 246, 0.05); }
.g-cell.sun { background: rgba(239, 77, 94, 0.05); }
.g-cell.today-col { background: var(--accent-soft); }

/* 日付行 */
.row-head .g-cell {
    height: 72px;
    grid-template-rows: 16px 26px 22px;
    align-content: center;
    justify-items: center;
    cursor: pointer;
}
.row-head .g-label { font-size: 11px; color: var(--text-3); }

.dow { font-size: 10px; font-weight: 700; color: var(--text-3); line-height: 16px; }
.date {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
}
.sun .dow, .sun .date { color: var(--sun); }
.sat .dow, .sat .date { color: var(--sat); }
.date.today { background: var(--accent); color: #fff !important; }
/* 上のカードで開いている日 */
.date.selected:not(.today) { box-shadow: 0 0 0 2px var(--accent); }
.g-cell.selected-col:not(.today-col) { background: rgba(var(--accent-rgb), 0.08); }
.event-name {
    font-size: 9px;
    font-weight: 700;
    color: var(--sun);
    line-height: 10px;
    max-width: 42px;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow-wrap: anywhere;
    align-self: start;
}
.event-name.plain { color: var(--accent); }

/* 気分行 */
.row-mood .g-cell { height: 46px; cursor: pointer; }

.pill {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    transition: transform 0.12s;
}
.pill.low { background: var(--low); box-shadow: 0 3px 10px rgba(var(--low-rgb), 0.35); }
.pill.mid { background: var(--mid); box-shadow: 0 3px 10px rgba(var(--mid-rgb), 0.35); }
.pill.high { background: var(--high); box-shadow: 0 3px 10px rgba(var(--high-rgb), 0.35); }
.pill.empty {
    width: 10px;
    height: 10px;
    background: transparent;
    border: 1.5px dashed var(--text-3);
}
.g-cell:active .pill { transform: scale(0.9); }

/* グラフ行 */
.row-chart { height: 150px; }
.row-chart .g-label { height: 150px; }
.row-chart canvas { display: block; }

/* メモ行 */
.row-memo .g-cell { height: 34px; cursor: pointer; }
.memo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}
.memo-dot.none { background: var(--surface-3); width: 5px; height: 5px; }

/* 習慣行 */
.row-habit .g-cell { height: 46px; cursor: pointer; }
.row-habit .g-label { color: var(--text); }

.grid-foot {
    padding: 10px 18px 6px;
    display: flex;
    gap: 8px;
}

/* ---------- まとめ ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}
.stat {
    background: var(--surface-2);
    border-radius: 14px;
    padding: 12px 6px;
    text-align: center;
}
.stat-value { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-value small { font-size: 12px; font-weight: 700; color: var(--text-2); margin-left: 1px; }
.stat-value.low { color: var(--low); }
.stat-value.mid { color: var(--mid); }
.stat-value.high { color: var(--high); }
.stat-label { font-size: 10px; font-weight: 700; color: var(--text-2); margin-top: 6px; }

.mood-mix { margin-top: 16px; }
.mood-mix-head { font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 8px; }
.mood-mix-bar {
    display: flex;
    gap: 2px;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    background: var(--surface-2);
}
.mood-mix-bar i { display: block; height: 100%; transition: width 0.3s ease; }
.mood-mix-bar .low { background: var(--low); }
.mood-mix-bar .mid { background: var(--mid); }
.mood-mix-bar .high { background: var(--high); }
.mood-mix-legend {
    display: flex;
    gap: 14px;
    margin-top: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-2);
}
.mood-mix-legend b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.mood-mix-legend .low { background: var(--low); }
.mood-mix-legend .mid { background: var(--mid); }
.mood-mix-legend .high { background: var(--high); }

/* ---------- ロック ---------- */

.lock {
    text-align: center;
    padding: 28px 18px 24px;
}
.lock-icon { font-size: 36px; margin-bottom: 8px; }
.lock h3 { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
.lock p { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }

/* ---------- ボタン ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 46px;
    padding: 0 20px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--text);
    transition: transform 0.12s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.block { width: 100%; }
.btn.small { height: 36px; padding: 0 14px; font-size: 13px; border-radius: 11px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { color: var(--low); }
.btn:disabled { opacity: 0.5; }

.foot {
    text-align: center;
    font-size: 11px;
    color: var(--text-3);
    padding-top: 6px;
}

/* ---------- シート ---------- */

.backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    max-height: 90dvh;
    display: flex;
    flex-direction: column;
    background: var(--sheet-bg);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.2);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet.open { transform: none; }

/* つまみ。まわりに余白を取って指で引きやすくする */
.sheet-handle {
    width: 40px;
    height: 5px;
    border-radius: 3px;
    background: var(--surface-3);
    margin: 10px auto 4px;
    flex-shrink: 0;
    position: relative;
}
.sheet-handle::before {
    content: '';
    position: absolute;
    inset: -14px -60px;
}

.sheet-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 20px calc(env(safe-area-inset-bottom) + 24px);
}

.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.sheet-title { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.sheet-sub { font-size: 13px; font-weight: 700; color: var(--sun); margin-top: 2px; }
.sheet-sub.plain { color: var(--accent); }

.day-nav { display: flex; gap: 4px; }

.section { margin-top: 22px; }
.section-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--text-2);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.section-hint { font-size: 12px; color: var(--text-3); margin: -4px 0 10px; line-height: 1.5; }

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
}
.row:last-child { border-bottom: none; }
.row-text { flex: 1; min-width: 0; }
.row-sub { display: block; font-size: 12px; color: var(--text-3); font-weight: 600; margin-top: 2px; }

.seg {
    display: inline-flex;
    background: var(--surface-2);
    border-radius: 11px;
    padding: 3px;
    gap: 2px;
}
.seg-btn {
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-2);
    transition: background 0.15s, color 0.15s;
}
.seg-btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

.switch {
    width: 50px;
    height: 30px;
    border-radius: 15px;
    background: var(--surface-3);
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s;
}
.switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s;
}
.switch.on { background: var(--high); }
.switch.on::after { transform: translateX(20px); }

.field {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface-2);
    outline: none;
    font-size: 16px;
    transition: border-color 0.15s;
}
.field:focus { border-color: var(--accent); }
.field::placeholder { color: var(--text-3); }
.field.inline { height: 40px; border-color: transparent; }
.field.inline:focus { border-color: var(--accent); background: var(--surface); }

.list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}
.list-item .field { flex: 1; }

.mini-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    color: var(--text-3);
    flex-shrink: 0;
}
.mini-btn:active { background: var(--surface-2); color: var(--low); }

.custom-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.custom-item:last-child { border-bottom: none; }
.custom-date {
    min-width: 54px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-2);
}
.custom-name { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.custom-name.holiday { color: var(--sun); }
.custom-tag { font-size: 10px; font-weight: 700; color: var(--text-3); }

.form {
    background: var(--surface-2);
    border-radius: 16px;
    padding: 14px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form .field { background: var(--surface); }
.form-row { display: flex; gap: 8px; align-items: center; }
.form-row .field { flex: 1; }
.form-row label { font-size: 13px; font-weight: 700; color: var(--text-2); white-space: nowrap; }
.form-toggle { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 600; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }

.pro-box {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-rgb), 0.04));
    border: 1px solid rgba(var(--accent-rgb), 0.3);
    border-radius: 16px;
    padding: 16px;
}
.pro-title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.pro-desc { font-size: 13px; color: var(--text-2); margin-bottom: 12px; line-height: 1.55; }
.key-box {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 12px;
    word-break: break-all;
    background: var(--surface);
    border-radius: 10px;
    padding: 10px 12px;
    margin: 8px 0;
    line-height: 1.5;
}

.help-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.help-item:last-child { border-bottom: none; }
.help-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface-2);
    display: grid;
    place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}
.help-title { font-size: 15px; font-weight: 800; margin-bottom: 4px; }
.help-body { font-size: 13px; color: var(--text-2); line-height: 1.6; }

.link-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
}
.link-row:last-child { border-bottom: none; }
.link-row .chev { color: var(--text-3); }

/* ---------- トースト ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(env(safe-area-inset-bottom) + 24px);
    z-index: 60;
    transform: translate(-50%, 20px);
    background: var(--text);
    color: var(--bg);
    font-size: 13px;
    font-weight: 700;
    padding: 10px 16px;
    border-radius: 12px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    max-width: calc(100vw - 32px);
    text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* 広い画面では中央に寄せる */
@media (min-width: 640px) {
    .header { padding-left: calc((100vw - 600px) / 2); padding-right: calc((100vw - 600px) / 2); }
    .main { max-width: 600px; margin: 0 auto; width: 100%; }
    .sheet { max-width: 600px; margin: 0 auto; }
}
