/* spaces のウェブ版。机・カード・ドックの色は iOS 版（App.swift）から写した（2026-11-04） */
:root {
  --ground: #D9E9F2;
  --deep: #B4D3E6;
  --ink: #1d2328;
  --ink2: rgba(29, 35, 40, .58);
  --ink3: rgba(29, 35, 40, .34);
  --line: rgba(29, 35, 40, .12);
  --blue: #026881;
  --blue-soft: rgba(2, 104, 129, .12);
  --green: #316745;
  --red: #b3261e;
  --glass: rgba(255, 255, 255, .55);
  --glass-edge: rgba(255, 255, 255, .7);
  --card: #fff;
  --mark: rgba(255, 226, 64, .75);
  --shadow: 0 10px 30px rgba(20, 50, 70, .16), 0 1px 3px rgba(20, 50, 70, .1);
  --font: "Zen Kaku Gothic New", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0B161C; --deep: #122C38;
    --ink: #e8ecef; --ink2: rgba(232, 236, 239, .6); --ink3: rgba(232, 236, 239, .34); --line: rgba(232, 236, 239, .14);
    --blue: #7CC6D8; --blue-soft: rgba(124, 198, 216, .16); --green: #6FB58A; --red: #ff8a80;
    --glass: rgba(20, 34, 42, .6); --glass-edge: rgba(255, 255, 255, .12); --card: #1c1c1f; --mark: rgba(255, 214, 10, .45);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0B161C; --deep: #122C38;
  --ink: #e8ecef; --ink2: rgba(232, 236, 239, .6); --ink3: rgba(232, 236, 239, .34); --line: rgba(232, 236, 239, .14);
  --blue: #7CC6D8; --blue-soft: rgba(124, 198, 216, .16); --green: #6FB58A; --red: #ff8a80;
  --glass: rgba(20, 34, 42, .6); --glass-edge: rgba(255, 255, 255, .12); --card: #1c1c1f; --mark: rgba(255, 214, 10, .45);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
#app { height: 100dvh; }

/* 机。色の地に大きなにじみを置き、磨りガラスを重ねる（iOS 版の Desk と同じ作り） */
.desk { position: fixed; inset: 0; z-index: 0; background: var(--ground); overflow: hidden; }
.desk::before, .desk::after { content: ""; position: absolute; border-radius: 50%; background: var(--deep); filter: blur(60px); }
.desk::before { width: 110vmax; height: 110vmax; left: -50vmax; top: -40vmax; }
.desk::after { width: 120vmax; height: 120vmax; right: -60vmax; bottom: -80vmax; opacity: .8; }
.desk .photo { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(28px) saturate(1.1); opacity: .55; }
.desk .frost { position: absolute; inset: 0; backdrop-filter: blur(20px); background: rgba(255, 255, 255, .08); }

/* 全体。左ペインとカードの場 */
.shell { position: relative; z-index: 1; height: 100%; display: grid; grid-template-columns: 300px minmax(0, 1fr); }
.shell.nopane { grid-template-columns: minmax(0, 1fr); }
.shell.nopane .pane { display: none; }
.hidden .shell { visibility: hidden; }

.glass { background: var(--glass); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); border: 1px solid var(--glass-edge); }

/* 左ペイン */
.pane { margin: 10px 0 10px 10px; border-radius: 22px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.find { display: flex; align-items: center; gap: 6px; margin: 10px 10px 6px; padding: 0 8px 0 12px; height: 36px; border-radius: 18px; background: rgba(127, 127, 127, .12); }
.find input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 14px; }
.find .tally { font-size: 11px; color: var(--ink3); white-space: nowrap; }
.find .tg { width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; color: var(--ink3); }
.find .tg.on { color: var(--red); background: rgba(179, 38, 30, .1); }
.find .tg svg { width: 15px; height: 15px; }
.rows { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.row { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; cursor: default; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.row:hover { background: rgba(127, 127, 127, .09); }
.row.on { background: var(--blue-soft); }
.row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { font-size: 11px; color: var(--ink3); }
.row .d { font-size: 11px; color: var(--ink3); white-space: nowrap; }
/* 列は Base の行にそろえる。山の列16・アイコンの列20で、題は x=64 から始まる。子の題は1段下げて x=88 だ（iOS 版と同じ） */
.row .c16 { width: 16px; flex: none; }
.row .lead { width: 68px; flex: none; }
.row .ic { width: 20px; display: grid; place-items: center; color: var(--ink2); flex: none; }
.row .ic svg { width: 15px; height: 15px; }
.row .ic.pin { color: var(--blue); }
.row .ic.pin svg { width: 13px; height: 13px; }
.row .chev { width: 16px; display: grid; place-items: center; color: var(--ink3); flex: none; transition: transform .15s; }
.row .chev svg { width: 10px; height: 10px; }
.row .ic.chev { width: 20px; color: var(--green); }
.row .chev.closed { transform: rotate(-90deg); }
.row.head { font-weight: 500; margin-top: 6px; height: 40px; }
.row.head .t { color: var(--ink); }
.row.head .ic { color: var(--ink2); }
.row.head.trash .ic { color: var(--ink3); }
.row.dark .t { color: var(--ink3); }
.row.add { color: var(--ink3); padding-left: 36px; }
/* 親から EVENT の子へ伸びる矢印。アイコンの列の真ん中（x=46）から下り、開いている子の題（x=88）の手前で矢じりになる */
.row .br { position: absolute; left: 45px; top: 0; width: 37px; pointer-events: none; color: var(--blue); opacity: .75; }
.row .br.through { bottom: 0; border-left: 1.5px solid currentColor; }
.row .br.turn { height: 50%; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; border-bottom-left-radius: 8px; }
.row .br.turn::after { content: ""; position: absolute; right: -3px; bottom: -4.75px; border: 4px solid transparent; border-left: 6px solid currentColor; border-right: 0; }
/* 最初の子では、線を親の山形のすぐ下（10px 上）から始める。折れる位置は子の題の真ん中のままにする */
.row .br.first { top: -10px; }
.row .br.turn.first { height: calc(50% + 10px); }
.empty { font-size: 13px; color: var(--ink3); padding: 6px 0 6px 72px; }
.sep { height: 1px; background: var(--line); margin: 8px 12px; }

/* カードの場 */
.stage { position: relative; display: grid; grid-template-rows: 52px 1fr 92px; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 0 22px 0 18px; font-size: 13px; color: var(--ink2); position: relative; min-width: 0; }
.topbar .trail { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; overflow: hidden; }
.topbar .step { display: flex; align-items: center; gap: 5px; min-width: 0; color: var(--ink2); font-size: 13px; }
.topbar .step.parent { flex-shrink: 1; min-width: 0; }
.topbar .step:not(.parent) { flex: none; }
.topbar .step .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .step:hover .nm { color: var(--ink); }
/* 居場所の丸。どれも塗らない細い線の輪で、色だけで分ける。Base は墨、親は千歳緑、ピンはブルスコブルー、ゴミ箱は淡い墨 */
.topbar .o { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; }
.topbar .o.base { color: var(--ink2); }
.topbar .o.parent { color: var(--green); }
.topbar .o.pin { color: var(--blue); }
.topbar .o.trash { color: var(--ink3); }
.topbar .sep2 { color: var(--ink3); }
.topbar .date { flex: none; font-size: 12px; color: var(--ink3); }
.topbar .sync { position: absolute; right: 8px; width: 6px; height: 6px; border-radius: 3px; background: var(--ink3); opacity: 0; transition: opacity .3s; }
.topbar .sync.on { opacity: 1; background: var(--blue); }
.topbar .sync.err { opacity: 1; background: var(--red); }
.place { position: relative; min-height: 0; min-width: 0; overflow: hidden; display: grid; place-items: center; padding: 6px 16px; }
.card { position: relative; border-radius: 18px; box-shadow: var(--shadow); background: var(--card); overflow: hidden; }
.card.shake { animation: shake .3s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.page { position: absolute; inset: 0; padding: 26px 26px; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; line-break: strict; line-height: 1.7; letter-spacing: .02em; outline: none; container-type: size; caret-color: transparent; color: transparent; }
.page::selection, .page *::selection { background: var(--blue-soft); }
.writing .page { color: var(--ink); }
.page img { display: inline-block; vertical-align: top; max-width: 100%; max-height: min(75cqw, 50cqh); border-radius: 10px; }
.page .q { font-size: .8em; color: transparent; cursor: pointer; }
.writing .page .q { color: var(--ink3); }
.page .bk { font-size: .72em; cursor: pointer; }
.writing .page .bk { color: var(--green); }
.page .hold { color: var(--ink3); }
.ink { position: absolute; inset: 0; pointer-events: none; }
/* 自分で描くカーソル（caret.js）。幅2・角1で、色はブルスコブルーだ */
.caret { position: absolute; width: 2px; border-radius: 1px; background: var(--blue); pointer-events: none; display: none; }
/* 書いているあいだのカードの右下の丸。写真を貼る・書くのをやめる */
.tools { position: absolute; right: 10px; bottom: 10px; display: none; gap: 4px; }
.writing .tools { display: flex; }
.tools .tl { width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; color: var(--ink2); background: rgba(127, 127, 127, .1); }
.tools .tl:hover { color: var(--blue); background: var(--blue-soft); }
.tools .tl svg { width: 18px; height: 18px; }
.writing .ink { display: none; }
.ink span { position: absolute; display: block; line-height: 1; white-space: pre; transform-origin: 50% 60%; }
.ink span.q { color: var(--ink3); }
.ink span.bk { color: var(--green); }
.ink i { position: absolute; display: block; background: var(--mark); border-radius: 2px; }
.blank-hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink3); font-size: 13px; pointer-events: none; }

/* ドック。楕円のカプセル1つに印を並べ、細い線で組を区切る */
.dockwrap { display: grid; place-items: center; }
.dock { display: flex; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 999px; }
.writing.narrow .dockwrap { visibility: hidden; }
.dock .b { width: 46px; height: 46px; border-radius: 23px; display: grid; place-items: center; color: var(--ink); position: relative; }
.dock .b svg { width: 22px; height: 22px; }
.dock .b:hover { background: rgba(127, 127, 127, .1); }
.dock .b.on { background: var(--blue-soft); color: var(--blue); }
.dock .b:disabled { opacity: .3; cursor: default; background: none; }
.dock .b[data-tip]:hover::after { content: attr(data-tip); position: absolute; bottom: 54px; left: 50%; transform: translateX(-50%); font-size: 11px; white-space: nowrap; padding: 3px 8px; border-radius: 8px; background: var(--ink); color: var(--card); pointer-events: none; }
.dock .bar { width: 1px; height: 24px; background: var(--line); margin: 0 6px; }

/* ドックの上に出す紙（つなぐ・設定） */
.sheet { position: absolute; bottom: 96px; left: 50%; transform: translateX(-50%); z-index: 5; border-radius: 20px; padding: 8px; width: 300px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); }
.sheet .it { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.sheet .it:hover { background: rgba(127, 127, 127, .1); }
.sheet .it:disabled { opacity: .35; cursor: default; background: none; }
.sheet .it svg { width: 18px; height: 18px; color: var(--ink2); flex: none; }
/* 設定の段。ラベルを左、操作を右に置く2列にそろえる（2026-11-04、指摘：左に詰まっていた） */
.sheet .grp { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 12px; }
.sheet .lab { flex: none; font-size: 13px; color: var(--ink2); }
.sheet .step { display: flex; align-items: center; gap: 6px; }
.sheet .step button { width: 32px; height: 32px; border-radius: 16px; background: rgba(127, 127, 127, .12); font-size: 17px; display: grid; place-items: center; }
.sheet .step .v { min-width: 44px; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; }
.sheet .slide { flex: 1; max-width: 160px; display: flex; align-items: center; gap: 8px; color: var(--ink2); }
.sheet .slide input { flex: 1; min-width: 0; accent-color: var(--blue); }
.sheet .tiles { display: flex; gap: 6px; }
.sheet .tile { width: 40px; height: 40px; border-radius: 10px; background: rgba(127, 127, 127, .12); display: grid; place-items: center; background-size: cover; background-position: center; border: 2px solid transparent; }
.sheet .tile.on { border-color: var(--blue); }
.sheet .tile svg { width: 18px; height: 18px; color: var(--ink2); }
/* 足元。名前と制作の表記と、規約の印 */
.sheet .foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 10px 12px 6px; border-top: 1px solid var(--line); }
.sheet .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sheet .who img { width: 24px; height: 24px; border-radius: 6px; flex: none; }
.sheet .who .nm { font-size: 13px; font-weight: 500; letter-spacing: .03em; }
.sheet .who .by { font-size: 10px; color: var(--ink3); white-space: nowrap; }
.sheet .who .by a { color: inherit; text-decoration: none; }
.sheet .who .by a:hover { color: var(--blue); }
.sheet .legal { display: flex; gap: 2px; }
.sheet .legal a { width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; color: var(--ink3); }
.sheet .legal a:hover { color: var(--blue); background: var(--blue-soft); }
.sheet .legal svg { width: 16px; height: 16px; }
.sheet hr { border: 0; height: 1px; background: var(--line); margin: 6px 8px; }

/* 一覧の長押しと右クリックのメニュー */
.menu { position: fixed; z-index: 20; min-width: 220px; max-width: 300px; max-height: 70vh; overflow-y: auto; padding: 6px; border-radius: 14px; box-shadow: var(--shadow); font-size: 14px; }
.menu .it { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
.menu .it:hover { background: rgba(127, 127, 127, .12); }
.menu .it:disabled { opacity: .35; cursor: default; background: none; }
.menu .it .ck { width: 14px; color: var(--blue); flex: none; }
.menu .it .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .it.sub { padding-left: 32px; }
.menu .it.danger { color: var(--red); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 6px; }

/* 名前や1行目を打つ窓・入口・鍵 */
.veil { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(0, 0, 0, .18); padding: 16px; }
.ask { width: min(360px, 100%); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); }
.ask h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; }
.ask p { font-size: 13px; color: var(--ink2); line-height: 1.7; margin: 0 0 12px; }
.field { width: 100%; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); padding: 0 12px; font-size: 15px; outline: none; margin-bottom: 10px; }
.field:focus { border-color: var(--blue); }
.peek { position: relative; margin-bottom: 10px; }
.peek .field { padding-right: 46px; margin-bottom: 0; }
.peek .eye { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--ink3); }
.peek .eye:hover, .peek .eye[aria-pressed="true"] { color: var(--blue); }
.peek .eye svg { width: 20px; height: 20px; }
.acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.btn { height: 38px; padding: 0 16px; border-radius: 19px; font-size: 14px; }
.btn.main { background: var(--blue); color: #fff; }
.btn.sub { background: rgba(127, 127, 127, .12); }
.btn:disabled { opacity: .5; }
.err { font-size: 12px; color: var(--red); min-height: 18px; }
.err small { display: block; color: var(--ink3); }
.code { font-family: ui-monospace, monospace; font-size: 15px; letter-spacing: .05em; padding: 12px; border-radius: 12px; background: rgba(127, 127, 127, .12); text-align: center; line-height: 1.6; user-select: all; margin-bottom: 12px; }

.gate { position: relative; z-index: 1; height: 100%; display: grid; place-items: center; padding: 16px; }
.gate .box { width: min(360px, 100%); border-radius: 26px; padding: 28px 24px; text-align: center; box-shadow: var(--shadow); }
.gate .icon { width: 72px; height: 72px; border-radius: 17px; }
.gate h1 { font-size: 22px; font-weight: 500; margin: 10px 0 6px; letter-spacing: .04em; }
.gate .note { font-size: 13px; color: var(--ink2); line-height: 1.7; margin: 0 0 18px; }
.gate form { text-align: left; }
.gate .lab { display: block; font-size: 12px; color: var(--ink2); margin-bottom: 6px; }
.gate .go { width: 100%; height: 44px; border-radius: 22px; display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--line); background: var(--card); font-size: 15px; margin-bottom: 8px; }
.gate .what { display: inline-block; font-size: 12px; color: var(--ink2); margin-top: 6px; }
.gate .legal { font-size: 11px; color: var(--ink3); margin: 14px 0 0; }
.gate .legal a { color: inherit; }
.gate .row2 { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; }
.gate .row2 button { color: var(--ink2); text-decoration: underline; }

/* 狭い画面では左ペインを机の上に重ねる */
@media (max-width: 759px) {
  .shell, .shell.nopane { grid-template-columns: minmax(0, 1fr); }
  .shell .pane { position: absolute; z-index: 10; inset: 8px 8px 100px 8px; margin: 0; }
  .shell.nopane .pane { display: none; }
  .stage { grid-template-rows: 44px 1fr 86px; }
  .page { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) { .card.shake { animation: none; } }

/* いまの天気・気温・湿度（weather.js）。日付の横に、日付と同じ淡い字で出す */
.topbar .wx { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink3); }
.topbar .wx:empty { display: none; }
.topbar .wx .i { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
