/* WINTER ARC — ダーク固定・スマホ主体。黒〜チャコール＋オレンジ1色。 */
:root {
  --bg: #0b0b0d; --bg2: #111114; --card: #17171c; --card2: #1d1d23; --line: #26262d; --line2: #33333b;
  --text: #f4f4f5; --mute: #8b8b95; --mute2: #5d5d66;
  --acc: #ff7a1a; --acc2: #ffb347; --acc-dim: rgba(255,122,26,.16);
  --red: #e5484d; --red-dim: rgba(229,72,77,.18);
  --d1: #6fcf97; --d2: #f2c94c; --d3: #ff6b35;
  --disp: "Bebas Neue", "Noto Sans JP", sans-serif;
  --sans: "Noto Sans JP", -apple-system, BlinkMacSystemFont, sans-serif;
  --r: 16px; --r2: 12px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; }
body { min-height: 100dvh; overscroll-behavior-y: none; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; color: var(--text); }
input:focus, textarea:focus { border-color: var(--acc); }
textarea { resize: none; min-height: 72px; }
input[type=time] { color-scheme: dark; }
::placeholder { color: var(--mute2); }
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(var(--sat) + 10px) 18px 8px; background: linear-gradient(var(--bg) 70%, transparent); }
.brand { font-family: var(--disp); font-size: 22px; letter-spacing: .14em; color: var(--text); }
.top-right { font-family: var(--disp); font-size: 16px; letter-spacing: .1em; color: var(--mute); display: flex; gap: 12px; align-items: center; }
.top-right b { color: var(--acc); font-weight: 400; }

.view { max-width: 520px; margin: 0 auto; padding: 4px 16px calc(var(--sab) + 92px); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; padding: 8px 8px calc(var(--sab) + 8px); background: rgba(11,11,13,.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabs button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--mute); font-size: 11px; padding: 4px 0; max-width: 120px; }
.tabs button .ic { font-size: 18px; line-height: 1; }
.tabs button.on { color: var(--acc); }

/* 共通部品 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-top: 12px; }
.card.tight { padding: 12px 14px; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 2px 6px; }
.sec h2 { margin: 0; font-family: var(--disp); font-size: 20px; letter-spacing: .12em; color: var(--text); font-weight: 400; }
.sec h2 small { font-family: var(--sans); font-size: 12px; color: var(--mute); letter-spacing: 0; margin-left: 8px; font-weight: 500; }
.sec .act { font-size: 12px; color: var(--mute); }
.mute { color: var(--mute); } .small { font-size: 12px; } .xs { font-size: 11px; }
.num { font-family: var(--disp); letter-spacing: .04em; font-weight: 400; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); font-size: 12px; color: var(--mute); }
.chip b { color: var(--text); font-weight: 700; }
.chip.acc { border-color: rgba(255,122,26,.4); color: var(--acc2); background: var(--acc-dim); }
.chip.red { border-color: rgba(229,72,77,.4); color: #ff8a8e; background: var(--red-dim); }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 16px; border-radius: 12px; background: var(--acc); color: #111; font-weight: 700; width: 100%; }
.btn.ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--line2); }
.btn.danger { background: var(--red-dim); color: #ff8a8e; border: 1px solid rgba(229,72,77,.4); }
.btn.sm { padding: 8px 12px; width: auto; font-size: 13px; border-radius: 10px; }
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 999px; transition: width .4s ease; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* ホーム：ヒーロー */
.hero { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 100% 0%, rgba(255,122,26,.18), transparent 55%), var(--card); }
.hero .day { font-family: var(--disp); font-size: 15px; letter-spacing: .18em; color: var(--mute); }
.hero .day b { color: var(--acc); font-weight: 400; }
.hero .rank { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 6px; }
.hero .rank-name { font-family: var(--disp); font-size: 54px; line-height: .95; letter-spacing: .04em; }
.hero .rank-jp { font-size: 12px; color: var(--mute); margin-top: 2px; }
.hero .xp { text-align: right; }
.hero .xp .v { font-family: var(--disp); font-size: 40px; line-height: 1; }
.hero .xp .l { font-size: 11px; color: var(--mute); letter-spacing: .1em; }
.hero .next { display: flex; justify-content: space-between; font-size: 11px; color: var(--mute); margin: 10px 0 6px; }
.hero .chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.quote { margin: 22px 4px 6px; font-weight: 900; font-size: 24px; line-height: 1.3; letter-spacing: .01em; }
.quote small { display: block; font-family: var(--disp); font-size: 13px; letter-spacing: .2em; color: var(--acc); font-weight: 400; margin-bottom: 6px; }
.decl { margin-top: 10px; }
.decl input { background: transparent; border: 0; border-bottom: 1px solid var(--line2); border-radius: 0; padding: 8px 2px; font-size: 15px; }

/* クエスト行 */
.quests { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.q { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); overflow: hidden; transition: background .2s, border-color .2s; }
.q .dbar { width: 4px; align-self: stretch; border-radius: 0 3px 3px 0; background: var(--dc, var(--mute)); margin-right: 2px; }
.q .body { flex: 1; min-width: 0; }
.q .en { font-family: var(--disp); font-size: 11px; letter-spacing: .18em; color: var(--mute); line-height: 1; }
.q .name { font-weight: 700; font-size: 16px; margin-top: 2px; }
.q .sub { font-size: 12px; color: var(--mute); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q .xpc { font-family: var(--disp); font-size: 15px; color: var(--mute); letter-spacing: .06em; min-width: 36px; text-align: right; }
.q .chk { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--line2); display: grid; place-items: center; color: transparent; font-size: 18px; flex: none; transition: all .2s; }
.q.done { background: var(--card2); border-color: rgba(255,122,26,.35); }
.q.done .chk { background: var(--acc); border-color: var(--acc); color: #111; }
.q.done .name { color: var(--text); }
.q.done .xpc { color: var(--acc2); }
.q.short .chk { background: var(--d2); border-color: var(--d2); }
.q .val { font-size: 12px; color: var(--acc2); margin-left: 6px; font-weight: 700; }
.q.weekly .chk { border-radius: 12px; }
.q.locked { opacity: .55; }

/* 借り・ボス */
.debts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.debt { display: inline-flex; align-items: center; gap: 8px; padding: 8px 10px 8px 12px; border-radius: 12px; background: var(--red-dim); border: 1px solid rgba(229,72,77,.35); font-size: 13px; }
.debt b { font-weight: 700; }
.debt button { padding: 4px 10px; border-radius: 8px; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; }
.boss { background: linear-gradient(135deg, #1a1012, var(--card)); border-color: rgba(229,72,77,.35); }
.boss.win { background: linear-gradient(135deg, #1a1409, var(--card)); border-color: rgba(255,179,71,.45); }
.boss .t { font-family: var(--disp); font-size: 13px; letter-spacing: .2em; color: #ff8a8e; }
.boss.win .t { color: var(--acc2); }
.boss .n { font-family: var(--disp); font-size: 34px; line-height: 1; margin: 4px 0 2px; }
.boss .d { font-size: 12px; color: var(--mute); }
.boss .res { font-weight: 900; font-size: 15px; margin-top: 8px; }

.banner { margin-top: 12px; padding: 16px; border-radius: var(--r); background: linear-gradient(135deg, var(--acc), #ff3d00); color: #111; font-weight: 900; font-size: 20px; letter-spacing: .02em; }
.banner small { display: block; font-family: var(--disp); font-size: 13px; letter-spacing: .2em; font-weight: 400; opacity: .8; }

/* ログ：ヒートマップ */
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 10px; }
.heat .dw { text-align: center; font-size: 10px; color: var(--mute2); font-family: var(--disp); letter-spacing: .1em; }
.heat .c { aspect-ratio: 1; border-radius: 7px; background: var(--bg2); border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; color: var(--mute2); position: relative; }
.heat .c.future { border-style: dashed; }
.heat .c.today { outline: 2px solid var(--acc); outline-offset: 1px; color: var(--text); }
.heat .c.perfect { background: var(--acc); border-color: var(--acc); color: #111; font-weight: 700; }
.heat .c.good { background: #3a3a44; color: var(--text); }
.heat .c.half { background: #26262d; color: var(--mute); }
.heat .c.fail { background: var(--red-dim); border-color: rgba(229,72,77,.5); color: #ff8a8e; }
.heat .c.boss::after { content: ""; position: absolute; top: 3px; right: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--acc2); }
.heat .c.phase { box-shadow: inset 0 -2px 0 var(--mute2); }
.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--mute); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; }
.tile .l { font-size: 11px; color: var(--mute); letter-spacing: .04em; }
.tile .v { font-family: var(--disp); font-size: 30px; line-height: 1.05; margin-top: 2px; }
.tile .v small { font-size: 14px; color: var(--mute); margin-left: 3px; }
.tile.acc .v { color: var(--acc); }
svg.chart { width: 100%; height: auto; display: block; margin-top: 8px; }
.rates { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.rate .row { font-size: 13px; justify-content: space-between; margin-bottom: 4px; }
.weeks { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.wk { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); font-size: 13px; }
.wk .res { font-family: var(--disp); letter-spacing: .12em; font-size: 14px; }
.wk .res.win { color: var(--acc2); } .wk .res.lose { color: #ff8a8e; } .wk .res.pending { color: var(--mute); }

/* カード */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 10px; }
.mcard { position: relative; aspect-ratio: 1/1.05; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(160deg, hsl(var(--h) 40% 22%), #0e0e11 70%); text-align: left; }
.mcard::before { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 60% at 20% 10%, hsla(var(--h), 80%, 60%, .35), transparent 60%); }
.mcard .cat { position: relative; font-family: var(--disp); letter-spacing: .22em; font-size: 11px; color: hsl(var(--h) 80% 70%); }
.mcard .tt { position: relative; font-weight: 900; font-size: 15px; line-height: 1.3; margin-top: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.mcard .dt { position: relative; font-size: 10px; color: var(--mute); margin-top: 6px; }
.mcard.locked { background: var(--bg2); filter: grayscale(1); opacity: .5; }
.mcard.locked::before { display: none; }
.mcard.locked .tt { color: var(--mute); font-size: 13px; }
.bigcard { aspect-ratio: 3/4; max-height: 60vh; }
.bigcard .tt { font-size: 22px; }
.bigcard .bd { position: relative; font-size: 14px; color: #ddd; margin-top: 10px; line-height: 1.6; }

/* 日記 */
.jf { margin-top: 12px; }
.jf label { display: block; font-size: 12px; color: var(--mute); margin-bottom: 4px; }
.jf label b { color: var(--acc); font-weight: 700; margin-right: 6px; font-family: var(--disp); letter-spacing: .1em; }
.entries { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.entry { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; }
.entry .h { display: flex; justify-content: space-between; font-size: 12px; color: var(--mute); margin-bottom: 6px; }
.entry .h b { color: var(--text); font-family: var(--disp); letter-spacing: .08em; font-size: 14px; font-weight: 400; }
.entry p { margin: 4px 0; font-size: 14px; white-space: pre-wrap; }
.entry p span { color: var(--acc); font-weight: 700; margin-right: 6px; font-size: 12px; }

/* 本棚 */
.books { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.book { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px; }
.book img, .book .noimg { width: 48px; height: 68px; object-fit: cover; border-radius: 6px; background: var(--bg2); flex: none; display: grid; place-items: center; font-size: 20px; color: var(--mute2); }
.book .t { font-weight: 700; font-size: 14px; line-height: 1.3; }
.book .a { font-size: 12px; color: var(--mute); margin-top: 2px; }
.book.done { opacity: .7; }
.results { margin-top: 8px; }

/* 設定 */
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set:last-child { border-bottom: 0; }
.set .l { font-size: 14px; } .set .l small { display: block; color: var(--mute); font-size: 11px; }
.set input[type=time], .set input[type=number] { width: 110px; text-align: center; padding: 8px; }
.sw { width: 50px; height: 30px; border-radius: 999px; background: var(--line2); position: relative; transition: background .2s; flex: none; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .2s; }
.sw.on { background: var(--acc); } .sw.on::after { left: 23px; }
.howto { font-size: 13px; color: var(--mute); line-height: 1.7; }
.howto b { color: var(--text); }
.howto ol { padding-left: 20px; margin: 6px 0; }

/* シート */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 18px calc(var(--sab) + 20px); border-top: 1px solid var(--line2); animation: up .22s ease; max-height: 88dvh; overflow: auto; }
@keyframes up { from { transform: translateY(30px); opacity: 0 } to { transform: none; opacity: 1 } }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 0 auto 14px; }
.sheet h3 { margin: 0; font-size: 20px; font-weight: 900; }
.sheet h3 small { display: block; font-family: var(--disp); font-size: 12px; letter-spacing: .2em; color: var(--acc); font-weight: 400; margin-bottom: 2px; }
.sheet .why { font-size: 13px; color: var(--mute); margin-top: 6px; line-height: 1.6; }
.sheet .field { margin-top: 14px; }
.sheet .field label { display: block; font-size: 12px; color: var(--mute); margin-bottom: 4px; }
.sheet .field input { font-size: 18px; font-family: var(--disp); letter-spacing: .06em; }
.sheet .field input[type=text], .sheet .field textarea { font-family: var(--sans); font-size: 15px; }
.sheet .actions { display: flex; gap: 8px; margin-top: 18px; }
.sheet .actions .btn { flex: 1; }
.cold { text-align: center; padding: 10px 0; font-size: 13px; color: var(--mute); }

.toast { position: fixed; left: 50%; bottom: calc(var(--sab) + 90px); transform: translateX(-50%); background: #fff; color: #111; font-weight: 700; padding: 10px 16px; border-radius: 12px; z-index: 60; font-size: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.5); animation: up .2s ease; }

.empty { text-align: center; padding: 28px 10px; color: var(--mute); font-size: 13px; }
.countdown { text-align: center; padding: 30px 10px 10px; }
.countdown .n { font-family: var(--disp); font-size: 96px; line-height: .9; color: var(--acc); }
.countdown .l { letter-spacing: .3em; font-family: var(--disp); color: var(--mute); font-size: 16px; }
.countdown p { font-weight: 900; font-size: 20px; margin: 14px 0 0; }
.countdown p.small { font-size: 13px; font-weight: 400; }
@media (min-width: 560px) { .view { padding-left: 0; padding-right: 0; } }

/* 日別の編集（ログ→日をタップ） */
.erow { padding: 8px 0; border-bottom: 1px solid var(--line); }
.erow:last-child { border-bottom: 0; }
.echk { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line2); display: grid; place-items: center; color: transparent; font-size: 15px; flex: none; }
.echk.on { background: var(--acc); border-color: var(--acc); color: #111; }
.erow input[type=number] { width: 72px; padding: 6px 8px; text-align: right; font-family: var(--disp); font-size: 16px; }
.erow input[type=time] { width: 104px; padding: 6px 8px; }
