/* 色。Android 版 Theme.kt の PALETTES と同じ値 */
:root, [data-theme="black"] { --bg: #000; --card: #1a1a1a; --chip: #2a2a2a; --sub: #111; --ink: #fff; --memo: #ddd; --gray: #808080; --dim: #555; --faint: #444; --link: #8ab4f8; --dot: #e5484d; --danger: #cc6666; --grain: 0; --shadow: rgba(0,0,0,.6); color-scheme: dark; --gauge: #262626; --gauge-late: #3a1f21; }
[data-theme="white"] { --bg: #fff; --card: #f1f1f1; --chip: #e2e2e2; --sub: #f7f7f7; --ink: #151515; --memo: #333; --gray: #7a7a7a; --dim: #aaa; --faint: #bbb; --link: #1a66d6; --dot: #e5484d; --danger: #c0392b; --grain: 0; --shadow: rgba(0,0,0,.15); color-scheme: light; --gauge: #e2e2e2; --gauge-late: #f7d9d8; }
[data-theme="beige"] { --bg: #ede3d1; --card: #f6eedf; --chip: #e2d5be; --sub: #e6dbc7; --ink: #2f271e; --memo: #4b4034; --gray: #8c7e6a; --dim: #b0a28b; --faint: #bfb29c; --link: #9a5b2e; --dot: #c2453b; --danger: #b04a3a; --grain: .32; --shadow: rgba(60,40,20,.18); color-scheme: light; --gauge: #ebe0cb; --gauge-late: #f0d2c6; }
[data-theme="brown"] { --bg: #2a2019; --card: #362a21; --chip: #47382c; --sub: #30251d; --ink: #f2e8d8; --memo: #dccdb7; --gray: #a3917b; --dim: #6f5f4f; --faint: #5e4f42; --link: #e3b27c; --dot: #e5684f; --danger: #e07a65; --grain: .5; --shadow: rgba(0,0,0,.5); color-scheme: dark; --gauge: #413328; --gauge-late: #4e2c25; }
/* 紙のざらつき: 画面全体に細かいノイズを重ねる（クリックは下に通す） */
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: var(--grain); background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .55 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); mix-blend-mode: multiply; }
[data-theme="brown"] body::after { mix-blend-mode: normal; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 .92  0 0 0 0 .8  0 0 0 .5 -.12'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif; font-size: 16px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--ink); background: none; border: 0; outline: none; width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--gray); }
.small { font-size: 13px; }

#login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 16px; text-align: center; }
.primary { background: var(--ink); color: var(--bg); border-radius: 20px; padding: 8px 22px; text-decoration: none; }

#main, #editor { max-width: 720px; margin: 0 auto; padding: 8px 16px 120px; }
header { display: flex; align-items: center; position: sticky; top: 0; background: var(--bg); z-index: 1; }
#tabs { flex: 1; display: flex; overflow-x: auto; scrollbar-width: none; }
#tabs button { white-space: nowrap; }
#tabs .addtab { color: var(--dim); }
#tabs button { position: relative; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
#tabs button.dragging { color: var(--ink); transform: scale(1.1); background: var(--chip); border-radius: 8px; cursor: grabbing; }
/* 未完のカードがあるタブの赤い点 */
#tabs .dot { position: absolute; top: 10px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--dot); }
#tabs button { font-size: 18px; color: var(--dim); padding: 12px 12px; }
#tabs button.on { color: var(--ink); }
#account { font-size: 12px; padding: 10px 4px; color: var(--dim); white-space: nowrap; }
.menuwrap { position: relative; }
#menuBtn { font-size: 20px; padding: 6px 8px 6px 12px; }
#menu { position: absolute; right: 0; top: 40px; background: var(--card); border-radius: 12px; padding: 8px 0; min-width: 200px; display: flex; flex-direction: column; box-shadow: 0 8px 24px var(--shadow); z-index: 60; }
#menu button { text-align: left; padding: 10px 16px; }
#menu button:hover { background: var(--chip); }
#menuEmail { padding: 6px 16px 8px; }

#list { display: flex; flex-direction: column; gap: 8px; }
.card { background: var(--card); border-radius: 12px; padding: 8px 0; user-select: none; }
.card .top { display: flex; align-items: center; }
.tri { color: var(--gray); width: 40px; height: 36px; flex: none; }
.card .body { flex: 1; min-width: 0; }
.card .t { font-size: 17px; overflow-wrap: anywhere; }
.sub { font-size: 12px; color: var(--gray); }
.check { width: 48px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.check span { width: 22px; height: 22px; border: 1.5px solid var(--gray); border-radius: 50%; }
.check:hover span { border-color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 12px 4px 40px; }
.chip { background: var(--chip); border-radius: 6px; padding: 5px 10px; font-size: 13px; text-decoration: none; color: var(--ink); }
a.chip { color: var(--link); }
.memo .ml { display: flex; }
.memo .pf { white-space: pre; flex: none; }
.memo .tx { flex: 1; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.memo { white-space: pre-wrap; color: var(--memo); font-size: 15px; line-height: 1.3; padding: 4px 16px 0 40px; overflow-wrap: anywhere; }
.memo .donetoggle { align-self: flex-start; text-align: left; color: var(--gray); font-size: 13px; padding: 6px 4px 2px 0; white-space: normal; }
.memo .donelines { padding-top: 2px; }

.section { color: var(--gray); font-size: 14px; text-align: left; padding: 16px 4px 4px; }
.subrow { background: var(--sub); border-radius: 12px; padding: 12px 16px; display: flex; align-items: center; user-select: none; }
.subrow .body { flex: 1; color: var(--gray); }
.subrow .sub { color: var(--dim); }
.subrow button { color: var(--gray); font-size: 14px; padding: 4px; }

#add { position: fixed; right: max(20px, calc(50vw - 340px)); bottom: 24px; width: 56px; height: 56px; border-radius: 50%; background: var(--chip); font-size: 24px; }

.ebar .grow { flex: 1; }
#home { display: flex; padding: 6px; margin-left: -6px; margin-right: 10px; border-radius: 50%; color: var(--ink); }
#home:hover { background: var(--chip); }
#eat { width: auto; color-scheme: inherit; font-size: 18px; }
.ebar { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.options { display: flex; flex-wrap: wrap; }
.options button { color: var(--dim); padding: 8px; font-size: 15px; }
.options button.on { color: var(--ink); }
.title { font-size: 22px; padding: 12px 0 0; }
.label { color: var(--gray); font-size: 13px; padding: 28px 0 6px; }
.tools { display: flex; gap: 6px; align-items: center; }
.tools button { background: var(--chip); border-radius: 6px; padding: 6px 14px; }
.hint { font-size: 12px; margin-left: 8px; }
textarea { resize: vertical; color: var(--memo); line-height: 1.35; padding: 10px 0; min-height: 140px; }
.row { display: flex; align-items: center; gap: 8px; }
.row input { padding: 8px 0; }
.row button { padding: 8px; flex: none; white-space: nowrap; }
#etime { width: auto; color-scheme: dark; font-size: 18px; }
.item { display: flex; align-items: center; }
.item .name { flex: 1; padding: 8px 0; overflow-wrap: anywhere; }
.item a.name { color: var(--link); text-decoration: none; }
.item button { color: var(--gray); font-size: 18px; padding: 0 8px; }
.ebottom { display: flex; gap: 24px; padding: 32px 0 24px; }
.danger { color: var(--danger); }
input::placeholder, textarea::placeholder { color: var(--faint); }
#themes { display: flex; padding: 4px 10px 6px; gap: 2px; }
#themes button { padding: 6px; font-size: 13px; color: var(--dim); }
#themes button.on { color: var(--ink); }

.memo { display: flex; flex-direction: column; }
.memo .copy { align-self: flex-end; color: var(--gray); font-size: 12px; padding: 6px 0 6px 12px; }
#historyToggle { padding: 8px 0; }
#historyList { padding: 0 0 40px; color: var(--gray); font-size: 13px; }
#historyList .hrow { display: flex; gap: 16px; padding: 2px 0; }
#historyList .hrow span:first-child { width: 130px; flex: none; }

/* メモの入力欄（1行ずつ） */
#ememo { padding: 10px 0; min-height: 140px; cursor: text; }
#ememo .blk { display: flex; align-items: flex-start; }
#ememo .bmark { flex: none; width: 1.1em; line-height: 1.35; color: var(--memo); cursor: pointer; user-select: none; }
#ememo .btx { flex: 1; min-width: 0; resize: none; overflow: hidden; padding: 0; min-height: 0; line-height: 1.35; color: var(--memo); }
#ememo .btx.done, .memo .ml.done .tx { text-decoration: line-through; color: var(--gray); }
.memo .pf.tick { cursor: pointer; }
.memo .pf.tick:hover { color: var(--ink); }
/* 名前の候補 */
#esugg { display: flex; flex-direction: column; }
#esugg .sugg { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; text-align: left; }
#esugg .sugg:hover span:first-child { text-decoration: underline; }

/* 共有タブの印 */
.person { display: inline-flex; margin-left: 2px; vertical-align: -1px; }
/* タブのメニュー */
#tabDialog { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
#tabDialog .dlg { background: var(--card); border-radius: 14px; padding: 18px 20px; width: 100%; max-width: 420px; box-shadow: 0 8px 30px var(--shadow); }
#tabDialog .dlgTitle { font-size: 18px; }
#tabDialog .label { padding: 18px 0 6px; }
#tabDialog .linkish { color: var(--ink); padding: 6px 0; }
#tabDialog #tdUrl { font-size: 13px; color: var(--gray); }
#tabDialog #tdMembers { padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
#tabDialog .dlgBottom { display: flex; gap: 16px; padding-top: 22px; align-items: center; }
#tabDialog .grow { flex: 1; }

/* 共有タブの知らせ */
.notice { background: var(--sub); border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.5; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
#ememo .blkdone { padding: 10px 0 2px; }
.card .sub.late { color: var(--dot); }
#edue { width: auto; color-scheme: inherit; }

/* ===== ステージングの提案 ===== */
.demo { text-align: center; padding: 2px 0 8px; }
/* 提案1: すばやく追加 */
#quickadd { display: flex; align-items: center; gap: 10px; margin: 8px 72px 0 0; padding: 12px 16px; border-radius: 12px; background: var(--sub); }
#quickadd .qplus { color: var(--gray); }
#quickadd input { padding: 0; }
/* 提案2: 詳細 */
#edetails { margin-top: 24px; }
#edetails summary { cursor: pointer; padding: 6px 0; list-style: none; }
#edetails summary::before { content: '▸ '; }
#edetails[open] summary::before { content: '▾ '; }
/* 提案3: 小さな情報の行 */
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 3px; font-size: 12px; color: var(--gray); }
.card .meta .mi { display: inline-flex; align-items: center; gap: 4px; }
.card .meta .mi.late { color: var(--dot); }
/* 提案4: 完了の手ごたえ */
.card .check span { transition: background .15s, border-color .15s; }
.card.leaving .check span { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 4px var(--card); }
.card.leaving { transition: opacity .35s .1s, transform .35s .1s; opacity: 0; transform: translateX(12px); }
