/* 見た目は kotone.click/dashboard に揃えてある。色・角丸・字づかい・部品の形は
   あちらの style.css / app.css から写した（`--brand-*` の値、`.app-field` の
   タイル、`.app-tab` のピル、`.app-save` のトースト、辞書の行）。
   «サーバー辞書はダッシュボード、ユーザー辞書はアクティビティ» と入口が分かれて
   いるので、同じものが違う見た目で出てこないようにする。

   **Webフォント (Zen Maru Gothic / Kiwi Maru) は読み込めない。** アクティビティの
   CSP は fonts.googleapis.com を許さない (例外は discord.com と cdn.discordapp.com
   だけ)。フォント名はダッシュボードと同じまま残し、実際に効くのは後ろの
   Hiragino Maru Gothic ProN 以降になる。 */

:root {
  --bg:#FBF3EA; --surface:#FFFBF5; --surface-sunken:#F0DEC4; --border:#E5CDAE;
  --ink:#4A2E1E; --ink-soft:#775B43;
  --brand-700:#6B4226; --brand-500:#845629; --brand-300:#B98B55;
  --brand-200:#D2AE84; --brand-100:#E9D8BF; --brand-50:#F5EADA; --on-brand:#FBF3EA;
  --brand-hover:#7C5033;
  --accent:#C9776B;
  --font-body:'Zen Maru Gothic','Hiragino Maru Gothic ProN','Yu Gothic UI','Meiryo',sans-serif;
  --font-display:'Kiwi Maru',var(--font-body);
  --r-chip:8px; --r-field:14px; --r-pill:999px; --r-tile:16px;
  color-scheme: light;
}

* { box-sizing:border-box; }

body {
  margin:0;
  background:var(--bg);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:15px;
  line-height:1.9;
}

:focus-visible { outline:3px solid var(--accent); outline-offset:3px; }

svg.icon {
  width:20px; height:20px; flex-shrink:0;
  stroke:currentColor; fill:none; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round;
}

/* アクティビティは狭い枠の中で、端末によっては下端にノッチが掛かる */
.app {
  padding:16px max(16px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom))
          max(16px, env(safe-area-inset-left));
  max-width:720px;
  margin-inline:auto;
}

/* ---- 見出し回り ---- */

.app-bar { display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:14px; }
.app-kicker {
  font-size:10.5px; font-weight:700; letter-spacing:.22em;
  color:var(--brand-500); line-height:1; margin-right:auto;
}
.app-me { display:flex; align-items:center; gap:10px; min-width:0; }
.app-me .ava {
  width:30px; height:30px; border-radius:50%; overflow:hidden; flex-shrink:0;
  background:var(--brand-200);
}
.app-me .ava img { width:100%; height:100%; object-fit:cover; display:block; }
.app-me .nm {
  font-size:12.5px; font-weight:700; min-width:0; max-width:14em;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

.app-mast { margin-bottom:18px; }
.app-mast h1 {
  font-family:var(--font-display); font-weight:500;
  font-size:clamp(22px,4.4vw,30px); line-height:1.4; margin:0; letter-spacing:.035em;
}

.app-tabs { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:22px; }
.app-tabs[hidden] { display:none; }
.app-tab {
  display:inline-flex; align-items:center; gap:9px;
  padding:10px 18px; min-height:44px; border-radius:var(--r-pill);
  font-family:inherit; font-size:13px; font-weight:700; line-height:1;
  color:var(--brand-700); background:var(--surface); border:0; cursor:pointer;
}
.app-tab .icon { width:18px; height:18px; }
.app-tab:hover { background:#FFFFFF; }
.app-tab[aria-current="page"] { background:var(--brand-700); color:var(--on-brand); }
.app-tab[aria-current="page"]:hover { background:var(--brand-hover); }

.app-sec { margin-bottom:14px; }
.app-h {
  font-family:var(--font-display); font-weight:500;
  font-size:clamp(18px,3.4vw,22px); margin:0; line-height:1.5;
}
.app-count {
  display:inline-block; margin-left:10px; font-size:12px; font-weight:700;
  color:var(--brand-700); background:var(--brand-100);
  border-radius:var(--r-pill); padding:4px 11px;
}
.app-lead { margin:6px 0 0; font-size:13px; color:var(--ink-soft); line-height:2; }

/* ---- 設定の行 ---- */

.app-fields { display:flex; flex-direction:column; gap:8px; }
.app-field {
  display:flex; align-items:center; gap:14px; flex-wrap:wrap;
  background:var(--surface); border-radius:var(--r-tile);
  padding:12px 16px; min-height:68px;
}
.app-field .lab { flex:1 1 auto; min-width:0; }
.app-field .lab .k { display:block; font-size:14px; font-weight:700; line-height:1.6; }
.app-field .lab .sub { display:block; font-size:11.5px; color:var(--ink-soft); line-height:1.7; }
.app-field .ctl { flex:0 0 auto; display:flex; align-items:center; gap:10px; width:100%; }
.app-field.is-inline { flex-wrap:nowrap; }
.app-field.is-inline .ctl { width:auto; }

.app-select { position:relative; display:block; width:100%; }
.app-select select {
  appearance:none; -webkit-appearance:none;
  font-family:inherit; font-size:14px; color:var(--ink); text-align:left;
  background:var(--brand-50); border:0; border-radius:var(--r-field); cursor:pointer;
  padding:11px 42px 11px 16px; min-height:46px; width:100%;
}
.app-select select:focus { outline:0; box-shadow:0 0 0 2px var(--brand-300); }
.app-select select:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.app-select .mark {
  position:absolute; right:17px; top:50%; width:8px; height:8px;
  border-right:1.8px solid var(--brand-500); border-bottom:1.8px solid var(--brand-500);
  transform:translateY(-70%) rotate(45deg); pointer-events:none;
}

.app-range {
  flex:1 1 140px; min-width:120px; height:44px;
  appearance:none; -webkit-appearance:none; background:transparent; cursor:pointer;
}
.app-range::-webkit-slider-runnable-track { height:8px; border-radius:var(--r-pill); background:var(--brand-100); }
.app-range::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none; margin-top:-7px;
  width:22px; height:22px; border-radius:50%; background:var(--brand-700); border:0;
}
.app-range::-moz-range-track { height:8px; border-radius:var(--r-pill); background:var(--brand-100); }
.app-range::-moz-range-thumb { width:22px; height:22px; border-radius:50%; background:var(--brand-700); border:0; }
.app-range:focus-visible { outline:3px solid var(--accent); outline-offset:2px; }
.app-val {
  font-size:14px; font-weight:700; font-variant-numeric:tabular-nums;
  min-width:4.4em; text-align:right;
}

/* ---- 入力 ---- */

.app-lab {
  display:block; font-size:10px; font-weight:700; letter-spacing:.14em;
  color:var(--brand-500); margin-bottom:7px;
}
.app-text {
  font-family:inherit; font-size:14px; color:var(--ink);
  background:var(--brand-50); border:0; border-radius:var(--r-field);
  padding:11px 16px; min-height:46px; width:100%; min-width:0;
}
.app-text:focus { outline:0; box-shadow:0 0 0 2px var(--brand-300); }
.app-text::placeholder { color:var(--brand-300); }

.app-stack { display:flex; flex-direction:column; gap:18px; }
.app-add { display:flex; flex-direction:column; gap:10px; }
.app-addrow { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; }
.app-addrow .app-fill { flex:1 1 200px; min-width:0; }
.app-addrow .app-check { flex:0 0 auto; margin-bottom:2px; }
.app-addrow .btn { flex:0 0 auto; margin-bottom:1px; }

.app-check {
  display:inline-flex; align-items:center; gap:9px; cursor:pointer;
  font-size:12.5px; color:var(--ink-soft); min-height:44px;
}
.app-check input { position:absolute; opacity:0; width:0; height:0; }
.app-check .box {
  width:21px; height:21px; border-radius:var(--r-chip); flex-shrink:0; position:relative;
  background:var(--brand-100);
}
.app-check input:checked + .box { background:var(--brand-700); }
.app-check input:checked + .box::after {
  content:""; position:absolute; left:7px; top:4px; width:4px; height:8px;
  border-right:1.8px solid var(--on-brand); border-bottom:1.8px solid var(--on-brand);
  transform:rotate(45deg);
}
.app-check input:focus-visible + .box { outline:3px solid var(--accent); outline-offset:2px; }

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

.btn {
  display:inline-flex; align-items:center; gap:8px;
  padding:15px 32px; border-radius:var(--r-pill);
  font-family:inherit; font-weight:700; font-size:14px; line-height:1;
  border:none; cursor:pointer; white-space:nowrap;
}
.btn-sm { padding:11px 24px; font-size:13px; }
.btn-primary { background:var(--brand-700); color:var(--on-brand); }
.btn-primary:hover { background:var(--brand-hover); }
.btn-soft { background:var(--brand-50); color:var(--brand-700); }
.btn-soft:hover { background:#FFFFFF; }
.btn:disabled { opacity:.4; cursor:default; }
.btn:disabled:hover { background:var(--brand-700); }
.btn-soft:disabled:hover { background:var(--brand-50); }

.app-del {
  width:44px; height:44px; flex-shrink:0; border:0; padding:0; cursor:pointer;
  background:transparent; color:var(--accent); border-radius:50%;
  display:flex; align-items:center; justify-content:center;
}
.app-del .icon { width:19px; height:19px; }
.app-del:hover { background:var(--brand-50); }

/* ---- 一覧 ---- */

.app-rows { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.app-row {
  display:flex; align-items:center; gap:14px; min-height:64px;
  background:var(--surface); border-radius:var(--r-tile); padding:10px 16px;
}
.app-row .body { flex:1 1 auto; min-width:0; }
.app-row .meta { font-size:11px; color:var(--ink-soft); line-height:1.7; }
.app-dict .nm { display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.app-dict .word { font-size:14px; font-weight:700; line-height:1.6; overflow-wrap:anywhere; }
.app-dict .arrow { color:var(--brand-300); font-weight:700; flex-shrink:0; }

.app-empty { text-align:center; padding:34px 0 30px; color:var(--ink-soft); }
.app-empty .mark {
  width:74px; height:74px; margin:0 auto 14px;
  clip-path:url(#bl-sq1); background:var(--surface-sunken); color:var(--brand-300);
  display:flex; align-items:center; justify-content:center;
}
.app-empty .mark .icon { width:28px; height:28px; }
.app-empty p { margin:0; font-size:13px; line-height:1.9; }

.app-note { margin:14px 0 0; font-size:12px; color:var(--ink-soft); line-height:1.95; }
.app-note a { color:var(--brand-700); }
.app-load { margin:22px 0; font-size:13px; color:var(--ink-soft); }
.app-none { margin:0; padding:12px 0; font-size:12.5px; color:var(--ink-soft); }

/* ---- 保存の知らせ ---- */

.app-save {
  position:fixed; right:16px; left:16px; bottom:calc(16px + env(safe-area-inset-bottom));
  z-index:40; padding:11px 22px; border-radius:var(--r-pill);
  background:var(--brand-700); color:var(--on-brand);
  font-size:12.5px; font-weight:700; letter-spacing:.04em; text-align:center;
}
.app-save.err { background:var(--accent); }
.app-save[hidden] { display:none; }
