/* ==========================================================================
   ワードローグ — スタイル
   ========================================================================== */

:root {
  --bg:        #0a0d14;
  --bg-2:      #10141f;
  --panel:     #161c2b;
  --panel-2:   #1d2537;
  --line:      #2a3448;
  --line-2:    #3a4761;
  --fg:        #e8eefc;
  --fg-dim:    #96a3bd;
  --fg-mute:   #64708a;

  --accent:    #ffd43b;
  --ok:        #8ce99a;
  --ng:        #ff5470;
  --idiom:     #ff9f43;
  --great:     #ff6b8b;
  --fire:      #ff7a2f;
  --ice:       #7ad7ff;
  --info:      #7ad7ff;
  --thunder:   #ffe14d;
  --poison:    #9dff5c;
  --dark:      #b47bff;

  --r:   10px;
  --r-s: 7px;
  --shadow: 0 10px 40px rgba(0, 0, 0, .55);
  --font: "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", Meiryo,
          system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性を必ず効かせる。display を指定した要素は UA の
   [hidden]{display:none} を上書きしてしまうため、ここで固定する。 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  overscroll-behavior: none;
}

body { user-select: none; }

#app { position: fixed; inset: 0; }

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.layer[hidden] { display: none !important; }

.screen {
  pointer-events: auto;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 8, 13, .82);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  overflow-y: auto;
  animation: fade .18s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ══ ボタン ══════════════════════════════════════════════════════════ */

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--fg);
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  padding: 9px 16px;
  cursor: pointer;
  transition: background .13s, border-color .13s, transform .08s, opacity .13s;
}
.btn:hover:not(:disabled) { background: #263049; border-color: #4b5a78; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, #ffd766, #f5b427);
  border-color: #b9830d;
  color: #241a02;
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe089, #ffc23a); }

.btn-ghost { background: transparent; }
.btn-danger { background: #4a1b28; border-color: #8a2f45; color: #ffd0d8; }
.btn-danger:hover:not(:disabled) { background: #63232f; }

.btn-lg { font-size: 1.15rem; padding: 13px 34px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  font-size: 1.1rem; border-radius: 9px;
}
.btn-close {
  position: absolute; top: 12px; right: 12px;
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  font-size: 1rem;
}

kbd {
  font-family: var(--mono);
  font-size: .82em;
  background: #0d1220;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
}
code {
  font-family: var(--mono);
  font-size: .88em;
  background: #0d1220;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent);
}

.muted { color: var(--fg-mute); font-size: .86rem; }
.ok  { color: var(--ok); }
.ng  { color: var(--ng); }

/* ══ パネル ══════════════════════════════════════════════════════════ */

.panel {
  position: relative;
  width: min(880px, 100%);
  max-height: 100%;
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: rise .2s ease-out;
}

.panel-head { position: relative; padding-right: 46px; flex: none; }
.panel-head h2 { margin: 0 0 2px; font-size: 1.32rem; letter-spacing: .02em; }
.panel-sub { margin: 0; color: var(--fg-dim); font-size: .88rem; }
.panel-sub strong { color: var(--accent); }

.panel-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ══ HUD ═════════════════════════════════════════════════════════════ */

.hud { display: flex; flex-direction: column; }

.hud-top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
  padding: 12px 14px;
}

.hud-col { min-width: 0; }
.hud-left  { display: flex; flex-direction: column; gap: 5px; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hud-center { text-align: center; }

.bar {
  position: relative;
  height: 19px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: 5px;
  /* 文字を外に出るので切り詰めない。丸い角は fill 側で確保する。 */
  overflow: visible;
}
.bar-fill {
  position: absolute; inset: 0 auto 0 0;
  width: 100%;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #ff6b81, #d92d47);
  transition: width .12s linear;
}
.bar-shield {
  position: absolute; inset: 0 auto 0 0;
  width: 0;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(180deg, #9ae6ff, #3aa9d8);
  opacity: .85;
  transition: width .12s linear;
}
.bar-xp { height: 14px; }
.bar-xp .bar-fill { background: linear-gradient(180deg, #ffe98a, #e8b425); }
.bar-sta { height: 10px; }
.bar-sta .bar-fill {
  background: linear-gradient(180deg, #a8f0c0, #3fbf6a);
  transition: width .06s linear;
}
.bar-sta .bar-fill.dashing { background: linear-gradient(180deg, #ffe98a, #f5a623); }
.bar-sta .bar-fill.empty { background: linear-gradient(180deg, #ff9a9a, #d94848); }
.bar-sta .bar-text { font-size: .62rem; }

.hud-self {
  align-self: flex-start;
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: #ffe9a8;
  background: rgba(8, 11, 18, .86);
  border: 1px solid rgba(255, 212, 59, .45);
  border-radius: 8px;
  padding: 3px 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.hud-self-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hud-self-mark {
  font-size: .64rem;
  font-weight: 600;
  letter-spacing: .14em;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 3px;
  padding: 0 4px;
  opacity: .85;
}
.hud-self-pow {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 600;
  color: #c7d3e8;
  letter-spacing: .02em;
}
.hud-self.invalid { color: #ffb3c1; border-color: rgba(255, 84, 112, .5); }
.hud-self.invalid .hud-self-pow { color: #ffb3c1; }
.bar-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: .74rem; font-weight: 700;
  font-family: var(--mono);
  text-shadow: 0 1px 2px rgba(0,0,0,.85);
  letter-spacing: .04em;
}
/* 細いバー (経験値 / スタミナ) には、中に文字を入れると読めない。
   右の外へ出して、横に並べる。 */
.bar-xp .bar-text,
.bar-sta .bar-text {
  inset: 50% auto auto 100%;
  transform: translate(7px, -50%);
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(8, 11, 18, .8);
  font-size: .68rem;
  color: #e8f0ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .95);
  white-space: nowrap;
}

.hud-stats {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  /* 背景が黒いので、必ず読める土台を置く。 */
  padding: 4px;
  border-radius: 8px;
  background: rgba(8, 11, 18, .78);
  border: 1px solid rgba(58, 71, 97, .8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* 能力 1 項目。ラベルは小さく淡く、数値は大きく明るく。 */
.statbox {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .04);
  white-space: nowrap;
}
.statbox-k {
  font-size: .68rem;
  color: #8ea0bd;
  letter-spacing: .08em;
}
.statbox-v {
  font-family: var(--mono);
  font-size: .84rem;
  font-weight: 700;
  color: #e8f0ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
}
.statbox.up .statbox-v { color: #8ce99a; }
.statbox.up { background: rgba(140, 233, 154, .10); }

.hud-stage {
  font-size: .8rem;
  color: var(--fg-dim);
  letter-spacing: .1em;
}
.hud-timer {
  font-family: var(--mono);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: .04em;
  text-shadow: 0 2px 10px rgba(0,0,0,.7);
}
.hud-timer.urgent { color: var(--ng); animation: pulse .6s infinite; }
@keyframes pulse { 50% { opacity: .5; } }

.hud-boss { margin-top: 6px; }
.boss-name { font-size: .78rem; color: var(--ng); letter-spacing: .06em; }
.bar-boss { height: 9px; margin-top: 3px; }
.bar-boss .bar-fill { background: linear-gradient(180deg, #ff9a6a, #c81e3c); transition: width .18s; }

.hud-num { display: flex; align-items: baseline; gap: 5px; }
.hud-num b { font-family: var(--mono); font-size: 1.05rem; }
.hud-num span { font-size: .7rem; color: var(--fg-mute); }

.hud-btns { display: flex; gap: 6px; margin-top: 2px; }
.hud-btns .btn-icon { pointer-events: auto; }

.hud-hint {
  align-self: center;
  margin-top: 4px;
  padding: 7px 18px;
  background: rgba(10, 14, 22, .92);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: .86rem;
  color: #f0f5ff;
  font-weight: 600;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .6);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .9);
  animation: rise .2s;
}

/* レベルアップの 3 択。ゲームは止めない。 */
.hud-choice {
  position: absolute;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%);
  z-index: 6;
  /* HUD は .layer で pointer-events: none。3 択だけはクリックできるように戻す。 */
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(8, 11, 18, .93);
  border: 1px solid rgba(255, 212, 59, .5);
  box-shadow: 0 10px 32px rgba(0, 0, 0, .55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: choiceIn .16s ease-out;
}
@keyframes choiceIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.hud-choice-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: center;
}
.hud-choice-title {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: #ffe9a8;
}
.hud-choice-timer {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 700;
  color: #c7d3e8;
  min-width: 1.4em;
  text-align: right;
}
.hud-choice-timer.urgent { color: #ff9a9a; }
.hud-choice-list { display: flex; gap: 8px; }
.hud-choice-list.small { flex-wrap: wrap; max-width: 420px; }
.hud-choice-note {
  margin: 0 0 5px;
  font-size: .74rem;
  color: #ffb3c1;
  text-align: center;
}
.hud-choice-forget {
  padding-top: 7px;
  border-top: 1px solid rgba(255, 84, 112, .35);
}

/* 3 択のカード。語彙の語と同じ見た目。 */
.choice-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 2px solid var(--line-2);
  background: rgba(255, 255, 255, .05);
  color: #e8f0ff;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .1s, background .1s, border-color .1s;
}
.choice-card:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .12); }
.choice-card:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.choice-card-cat {
  font-size: .62rem;
  font-weight: 600;
  letter-spacing: .08em;
  opacity: .8;
}
.choice-card-fx {
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 600;
  opacity: .92;
}
.choice-card.forget {
  min-width: 46px;
  padding: 5px 8px;
  font-size: .9rem;
  border-style: dashed;
  border-color: rgba(255, 84, 112, .55);
  background: rgba(255, 84, 112, .10);
}
.choice-card.forget:hover { background: rgba(255, 84, 112, .22); }
.choice-card.gone { opacity: .38; }
.choice-card .conn-mark {
  position: absolute;
  top: -6px;
  right: -6px;
  font-size: .58rem;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--connect, #8ab4ff);
  color: #06121f;
  font-weight: 700;
}
.hud-weapons {
  margin-top: auto;
  display: flex;
  gap: 8px;
  padding: 8px 14px 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  /* 武器チップの土台。黒背景の上にそのまま置いても読めるように。 */
  background: linear-gradient(to top, rgba(6, 8, 13, .82), rgba(6, 8, 13, 0));
  border-radius: 12px 12px 0 0;
}

.wchip {
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 8px;
  background: rgba(16, 21, 32, .95);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
  color: #eef3ff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .85);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .5);
  transition: border-color .12s, background .12s;
}
.wchip:hover { background: #1f2939; }
.wchip .wchip-lv {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--fg-dim);
  background: #05070c;
  border-radius: 4px;
  padding: 1px 5px;
}
.wchip .wchip-base {
  font-weight: 800;
  color: #ffd43b;
  letter-spacing: .1em;
}
.wchip .wchip-txt { letter-spacing: .04em; }
.slot-tail {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  cursor: default;
  opacity: 1;
}
.slot-tail:hover { transform: none; }
.wchip.broken {
  border-color: var(--ng);
  background: rgba(72, 18, 30, .95);
  color: #ffc9d4;
}
.wchip.broken .wchip-txt { text-decoration: line-through; text-decoration-thickness: 1px; }
.wchip.idiom { border-color: var(--idiom); }
.wchip.great { border-color: var(--great); box-shadow: 0 0 0 1px rgba(255,107,139,.35); }

/* ダッシュボタン。画面の右中段に置く。
   右下は武器チップ (入れ替えのドロップ先) があるので避ける。 */
.hud-dash {
  position: absolute;
  right: 14px;
  /* 武器チップ (下) も 3 択 (中央下) も避けた位置。 */
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  pointer-events: auto;
  touch-action: none;
  width: 96px;
  height: 96px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid rgba(255, 212, 59, .6);
  background: rgba(10, 14, 22, .78);
  color: #ffe9a8;
  font: inherit;
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .08em;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: transform .08s, background .08s, border-color .08s;
}
.hud-dash[hidden] { display: none; }
.hud-dash.on {
  background: rgba(255, 212, 59, .28);
  border-color: #ffd43b;
  color: #fff6d8;
  transform: translateY(-50%) scale(.95);
}
/* スタミナが足りないと押しても利かない。 */
.hud-dash.empty { opacity: .4; }

/* ダッシュボタンは右中段。3 択は中央下なので縦には重ならない。
   横が狭いときだけ 3 択の幅が届くので、右に余白を残す。 */
body.touch .hud-choice { left: calc(50% - 60px); max-width: calc(100vw - 140px); }

.hud-paused {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: rgba(6, 8, 13, .6);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}
.paused-inner { text-align: center; }
.paused-title { font-size: 2rem; font-weight: 700; letter-spacing: .2em; }
.paused-hint { color: var(--fg-dim); font-size: .84rem; margin-top: 6px; }

/* ══ 言葉鍛冶 ════════════════════════════════════════════════════════ */

.panel-forge { width: min(1000px, 100%); height: min(760px, 100%); }

.forge-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
}

.forge-weapons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 4px;
}

.wrow {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-2);
  padding: 11px 13px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.wrow.broken { border-color: rgba(255,84,112,.55); background: rgba(52,16,25,.5); }
.wrow.idiom  { border-color: rgba(255,159,67,.5); }
.wrow.great  { border-color: rgba(255,107,139,.6); }

.wrow-head {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.wrow-name { font-weight: 700; font-size: .98rem; }
.wrow-core {
  font-size: .74rem;
  color: var(--fg-mute);
  border: 1px dashed var(--line-2);
  border-radius: 5px;
  padding: 0 5px;
}
.wrow-lv {
  font-family: var(--mono);
  font-size: .74rem;
  background: #0c1018;
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--fg-dim);
}
/* 「空にする」 … 文の語を全部語彙へ戻す。並べ直すときの逃げ道。 */
.wrow-clear {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--fg-dim);
  background: #0c1018;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 1px 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.wrow-clear:hover { color: var(--fg); border-color: var(--fg-dim); }
.wrow-grade {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 700;
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.grade-plain  { color: var(--ok); }
.grade-idiom  { color: var(--idiom); }
.grade-great  { color: var(--great); }
.grade-broken { color: var(--ng); }

.wrow-why { font-size: .8rem; color: var(--ng); }

.slots { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.slot {
  width: 58px; height: 44px;
  display: grid; place-items: center;
  border: 1.5px dashed var(--line-2);
  border-radius: 8px;
  background: #0c1018;
  font-size: 1.02rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
  position: relative;
}
.slot.filled {
  border-style: solid;
  border-color: var(--line-2);
  background: #1a2233;
}
.slot.filled:hover { background: #232d42; }
.slot.armed { border-color: var(--accent); background: #2b2712; box-shadow: 0 0 0 2px rgba(255,212,59,.2); }
.slot.hinted { border-color: var(--accent); animation: hintPulse 1.1s infinite; }
@keyframes hintPulse { 50% { box-shadow: 0 0 0 3px rgba(255,212,59,.25); } }
.slot.drop { border-color: var(--ok); background: #14261a; }
.slot .empty-mark { color: var(--fg-mute); font-size: 1.1rem; font-weight: 400; }

/* ドラッグ */
.slot.filled, .pword, .sen-word { cursor: grab; }
.slot.filled:active, .pword:active, .sen-word:active { cursor: grabbing; }
/* 掴んだ語は薄くし、指の下へ出る影だけを見えるようにする。 */
.dragging { opacity: .22; filter: saturate(.5); }
.drag-ghost {
  position: fixed;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 9px;
  border: 1.5px solid var(--accent);
  border-radius: 9px;
  background: #26200a;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .55), 0 0 0 3px rgba(255, 212, 59, .18);
  pointer-events: none;
  transform: scale(1.06) rotate(-1.5deg);
}
.drag-ghost .dg-word {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--fg);
  white-space: nowrap;
}
.drag-ghost .dg-conn {
  padding: 0 6px;
  border-radius: 999px;
  border: 1.5px solid rgba(138, 180, 255, .9);
  background: rgba(138, 180, 255, .22);
  color: #b9d2ff;
  font-size: .82rem;
  font-weight: 700;
}
.drop-hot {
  border-color: var(--accent) !important;
  background: #2b2712 !important;
  box-shadow: 0 0 0 2px rgba(255,212,59,.35);
  transform: translateY(-1px);
}

.slot-plus {
  width: 26px; text-align: center;
  color: var(--fg-mute); font-size: .8rem;
}

/* ── 自由に並べた文 ───────────────────────────────────────────────────────
   枠に嵌めず、語のあいだに隙間 ("＋") を置いて自由に配置する。
   接続詞は「語 + 接続詞」の 1 組で、語のタップで切り替わる。            */
.sen-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border: 1px solid var(--line-1);
  border-radius: 10px;
  background: #0c1018;
  min-height: 56px;
}
.sen-item { display: inline-flex; align-items: center; gap: 3px; }
.sen-word {
  min-width: 48px; min-height: 40px;
  padding: 5px 9px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  background: #1a2233;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  /* これが無いと指がスクロールになり、ドラッグの途中で pointercancel される。 */
  touch-action: none;
  transition: border-color .12s, background .12s, transform .08s;
}
.sen-word:active { cursor: grabbing; }
.sen-word.armed { border-color: var(--accent); background: #2b2712; }
/* 長押しで持ち上げた語。文の語や隙間をタップで移せる。 */
.sen-word.held {
  border-color: var(--accent);
  background: #3a2f10;
  box-shadow: 0 0 0 2px rgba(255, 212, 59, .30);
  transform: translateY(-2px);
}
.sen-word.sen-tail {
  border-style: dashed;
  background: #121826;
  color: var(--fg-mute);
  cursor: default;
}
/* 文の語を外すボタン。ホバー / 選択中だけ濃くする。 */
.sen-out {
  width: 24px; height: 26px;
  margin: 0 1px 0 2px;
  padding: 0;
  display: grid; place-items: center;
  border: 1.5px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--fg-mute);
  font-size: .82rem;
  line-height: 1;
  cursor: pointer;
  opacity: .30;
  touch-action: none;
  transition: opacity .12s, color .12s, border-color .12s, background .12s;
}
.sen-item:hover .sen-out,
.sen-out:focus-visible {
  opacity: 1;
  border-color: rgba(255, 138, 128, .45);
  background: rgba(255, 138, 128, .10);
  color: #ff9d92;
}
.sen-out:active { background: rgba(255, 138, 128, .22); }
/* タッチにはホバーが無いので、常時少し濃くしておく。 */
@media (hover: none) {
  .sen-out { opacity: .55; }
}

.sen-conn {
  min-width: 34px; height: 30px;
  margin: 0 1px;
  padding: 0 6px;
  display: grid; place-items: center;
  border: 1.5px dashed rgba(138, 180, 255, .45);
  border-radius: 999px;
  background: rgba(138, 180, 255, .07);
  color: #b9d2ff;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}
.sen-conn.filled {
  border-style: solid;
  border-color: rgba(138, 180, 255, .9);
  background: rgba(138, 180, 255, .22);
}
.sen-conn.empty { opacity: .45; }
.sen-conn.empty:hover { opacity: 1; }
.sen-gap {
  width: 30px; min-height: 40px;
  display: grid; place-items: center;
  border: 1.5px dashed transparent;
  border-radius: 8px;
  color: var(--fg-mute);
  font-size: 1rem;
  opacity: .35;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: opacity .12s, border-color .12s, background .12s;
}
/* 語を差し込む目印。タップでも置けるので「押せる」ことが分かる。 */
.sen-gap:hover { opacity: .9; border-color: var(--line-2); }
.wrow-empty {
  padding: 8px 10px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  font-size: .78rem;
}
.wrow-kind.dim { color: var(--fg-mute); }

/* 文面。枠の語を区切って連結した結果と、その分割結果 */
.sentence {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 9px;
  background: #080b12;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: .95rem;
  letter-spacing: .06em;
}
.sn-parts { display: inline-flex; align-items: center; gap: 3px; }
.sn-plus { color: var(--fg-mute); font-size: .78rem; }
.sn-conn-slot { display: inline-flex; align-items: center; }
.sn-conn-empty { color: var(--fg-mute); font-size: .78rem; opacity: .5; }
.sn-w {
  background: #1a2233;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 1px 5px;
  font-weight: 700;
}
.sn-conn  { border-style: dotted; color: #a8c8ff; background: #141d30; }
.sn-verb  { border-color: rgba(255,143,171,.5); color: #ffc2d1; background: #2a1620; }
.sn-buff  { border-color: rgba(180,123,255,.5); color: #dcc6ff; background: #1e1630; }
.sn-empty { color: #3a4459; font-weight: 400; }

.wrow-self { border-color: rgba(255, 212, 59, .35); background: #14120a; }
/* 自身の文は行の背景も少し黄め。末尾の「人」まで含む。 */
.wrow-self .sen-row { border-color: rgba(255, 212, 59, .22); background: #100e07; }
.wrow-kind {
  font-size: .7rem;
  color: var(--fg-mute);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
}

.sn-res {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sn-eq { color: var(--fg-mute); }
.sn-text {
  font-size: 1.1rem;
  color: var(--ok);
  letter-spacing: .1em;
}
.sn-seg { display: inline-flex; gap: 2px; }
.sg {
  font-style: normal;
  font-size: .68rem;
  color: var(--fg-mute);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 0 3px;
}
.sg-gram { color: #b9a8ff; border-style: dotted; }
.sg-verb { color: #ffb0c2; border-color: rgba(255,143,171,.35); }
.sn-pred {
  font-size: .68rem;
  color: #8ab4ff;
  border: 1px solid rgba(138,180,255,.45);
  border-radius: 3px;
  padding: 0 4px;
}

.wrow-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  font-size: .74rem;
  font-family: var(--mono);
}
.stat {
  background: #0c1018;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--fg-dim);
}
.stat.up   { color: var(--ok);  border-color: rgba(140,233,154,.35); }
.stat.bad  { color: var(--ng);  border-color: rgba(255,84,112,.35); }
.stat.idom { color: var(--idiom); border-color: rgba(255,159,67,.45); background: rgba(60,38,14,.4); }
.stat.nat  { color: #8ab4ff; border-color: rgba(138,180,255,.4); }

/* 自然さの内訳。加点は青、減点は赤で区別する。 */
.wrow-nat {
  display: flex; flex-wrap: wrap; gap: .3rem .5rem;
  align-items: baseline; margin: .2rem 0 .3rem;
  font-family: var(--mono); font-size: .72rem; line-height: 1.5;
}
.wrow-nat .nat-total { color: #8ab4ff; font-weight: 700; }
.wrow-nat .nat-plus  { color: var(--ok); }
.wrow-nat .nat-minus { color: var(--ng); }

/* 語彙 */
.forge-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 12px;
  background: #0a0e17;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.forge-side-head { display: flex; align-items: baseline; justify-content: space-between; }
.forge-side-head h3 { margin: 0; font-size: .95rem; letter-spacing: .04em; color: var(--fg-dim); }

/* 語を置くときの 3 手順。接続詞プールを消した余白はここに回す。 */
.forge-how {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: .78rem;
  color: var(--fg-mute);
}
.forge-how li {
  display: flex;
  align-items: baseline;
  gap: 8px;
  line-height: 1.35;
}
.forge-how b {
  flex: none;
  min-width: 62px;
  padding: 1px 7px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #141b28;
  color: var(--fg-dim);
  font-size: .74rem;
  font-weight: 700;
  text-align: center;
}
.forge-how em { color: var(--accent); font-style: normal; font-weight: 700; }

.lexicon {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  overflow-y: auto;
  align-content: start;
  padding: 8px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  min-height: 150px;
  flex: 1;
}

.pword {
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
  position: relative;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: #161e2e;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  /* 語彙の語はドラッグの起点。スクロールに奪われると置けない。 */
  touch-action: none;
  transition: transform .08s, border-color .12s, background .12s;
  line-height: 1.1;
  text-align: center;
  padding: 2px;
  overflow: hidden;
}
.pword:hover { background: #1f2939; transform: translateY(-1px); }
.pword.armed {
  border-color: var(--accent);
  background: #2d2812;
  box-shadow: 0 0 0 2px rgba(255,212,59,.28);
}
.pword.empty { border-style: dashed; border-color: #232d3f; background: transparent; cursor: default; }
.pword.empty:hover { transform: none; background: transparent; }
.pword-n {
  position: absolute;
  right: 2px; bottom: 1px;
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--fg-mute);
}
.pword-conn { opacity: .85; border-style: dashed; }

.forge-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.forge-actions .btn { font-size: .82rem; padding: 7px 10px; }
.forge-note { flex: 1; font-size: .8rem; color: var(--fg-dim); }
.forge-note strong { color: var(--accent); }
.btn-forget.on {
  background: rgba(255, 84, 112, .22);
  border-color: var(--ng);
  color: #ffd0d8;
}
.btn-forget:disabled { opacity: .4; cursor: not-allowed; }

/* 「忘れる」モード。語彙の語が捨てられる。 */
.pword.forgetable {
  cursor: crosshair;
  border-style: dashed;
  border-color: var(--ng);
  opacity: .9;
}
.pword.forgetable:hover {
  background: rgba(255, 84, 112, .25);
  transform: scale(1.06);
}

/* 語を選んだ状態。文の行の落とし場だけを明るくする。 */
.placing .sen-row {
  border-color: rgba(255, 212, 59, .38);
  background: #0f1119;
}
.placing .sen-gap {
  opacity: .95;
  border-color: var(--line-2);
  background: rgba(255, 212, 59, .07);
  color: var(--accent);
}
.placing .sen-word { cursor: copy; }
/* 「忘れる」モードのボタン状態は .btn-forget.on で表現する。 */
#lexiconCount.full { color: var(--ng); font-weight: 700; }

.forge-hint {
  font-size: .78rem;
  color: var(--fg-dim);
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 8px 10px;
  max-height: 130px;
  overflow-y: auto;
}
.forge-hint table { width: 100%; border-collapse: collapse; font-family: var(--mono); }
.forge-hint td { padding: 1px 0; }
.forge-hint .hc { color: var(--idiom); }

.forge-detail {
  font-size: .76rem;
  color: var(--fg-dim);
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  padding: 8px 10px;
  min-height: 56px;
}
.forge-detail .dt { color: var(--fg); font-weight: 700; display: block; margin-bottom: 2px; }
.forge-detail .dl { font-family: var(--mono); color: var(--fg-mute); }
/* 直前の操作の結果 (入れた / 戻した / 理由)。 */
.forge-detail .dt.msg { color: var(--ok); }
/* その語に使える接続詞の一覧。 */
.forge-detail .conn-list { color: var(--info, #7ad7ff); }

/* 接続詞を一覧から一発で選ぶメニュー。語の右のマスをタップして開く。 */
.conn-picker {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: 6px;
  background: #0d1320;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .5);
  font-size: .8rem;
}
.conn-picker-head {
  color: var(--fg-mute);
  font-size: .68rem;
  padding: 0 4px 4px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.conn-pick {
  text-align: left;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  touch-action: manipulation;
}
.conn-pick:hover { color: var(--fg); background: rgba(138, 180, 255, .12); }
.conn-pick.cur { color: var(--info, #7ad7ff); border-color: var(--info, #7ad7ff); }

/* ══ タイトル ════════════════════════════════════════════════════════ */

.title-wrap { text-align: center; animation: rise .3s ease-out; }

.title-main {
  margin: 0;
  font-size: clamp(2.8rem, 11vw, 5.4rem);
  font-weight: 900;
  letter-spacing: .04em;
  line-height: 1;
  background: linear-gradient(180deg, #fff6d0, #ffb43b 60%, #ff6b3b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 160, 50, .3));
}
.title-main span { display: block; }
.title-tag {
  margin: 10px 0 30px;
  color: var(--fg-dim);
  letter-spacing: .18em;
  font-size: .92rem;
}

.title-menu { display: flex; flex-direction: column; gap: 9px; width: min(300px, 84vw); margin: 0 auto; }

.title-record {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 30px auto 0;
  max-width: 480px;
}
.title-record div { text-align: center; }
.title-record b {
  display: block;
  font-family: var(--mono);
  font-size: 1.3rem;
  color: var(--accent);
}
.title-record span { font-size: .7rem; color: var(--fg-mute); letter-spacing: .08em; }

/* ══ ステージ選択 ════════════════════════════════════════════════════ */

.panel-stages { width: min(760px, 100%); }
.stage-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }

.stage-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--fg);
  transition: border-color .13s, background .13s, transform .08s;
}
.stage-card:hover:not(:disabled) { border-color: var(--line-2); background: #1b2333; transform: translateX(2px); }
.stage-card:disabled { opacity: .38; cursor: not-allowed; }
.stage-num {
  font-family: var(--mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--fg-mute);
  width: 34px; text-align: center;
}
.stage-meta { flex: 1; min-width: 0; }
.stage-name { font-weight: 700; }
.stage-intro { font-size: .78rem; color: var(--fg-mute); }
.stage-tags { display: flex; gap: 5px; margin-top: 3px; }
.tag {
  font-size: .68rem;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--fg-mute);
}
.tag.boss { color: var(--ng); border-color: rgba(255,84,112,.4); }
.tag.done { color: var(--ok); border-color: rgba(140,233,154,.4); }
.stage-stars { font-size: 1.1rem; color: var(--accent); letter-spacing: .1em; }

/* ══ 武器選択 ════════════════════════════════════════════════════════ */

.loadout-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 9px;
  overflow-y: auto;
}

.lo-card {
  position: relative;
  padding: 11px 13px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--fg);
  transition: border-color .13s, background .13s;
}
.lo-card:hover { background: #1b2333; }
.lo-card.on {
  border-color: var(--accent);
  background: #241f0d;
  box-shadow: inset 0 0 0 1px rgba(255,212,59,.25);
}
.lo-card:disabled { opacity: .35; cursor: not-allowed; }
.lo-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.lo-kind {
  font-size: .68rem; font-weight: 600; letter-spacing: .06em;
  color: var(--accent); border: 1px solid currentColor;
  border-radius: 3px; padding: 0 4px; opacity: .85;
}
.lo-core { font-size: .72rem; color: var(--fg-mute); }
.lo-desc { font-size: .76rem; color: var(--fg-dim); margin-top: 3px; }
.lo-lv {
  position: absolute; top: 9px; right: 11px;
  font-family: var(--mono); font-size: .72rem; color: var(--accent);
}
.lo-check {
  position: absolute; top: 8px; right: 10px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: var(--accent);
  color: #241a02;
  display: grid; place-items: center;
  font-size: .8rem; font-weight: 800;
}

/* ══ 報酬 ════════════════════════════════════════════════════════════ */

.panel-reward { width: min(940px, 100%); }
.reward-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.rw-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--fg);
  transition: border-color .13s, background .13s, transform .1s;
}
.rw-card:hover {
  border-color: var(--accent);
  background: #201c0f;
  transform: translateY(-3px);
}
.rw-kind {
  font-size: .68rem;
  letter-spacing: .1em;
  color: var(--fg-mute);
  text-transform: none;
}
.rw-glyph {
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
}
.rw-name { font-weight: 700; font-size: .95rem; }
.rw-desc { font-size: .78rem; color: var(--fg-dim); }
.rw-fx { font-family: var(--mono); font-size: .72rem; color: var(--ok); }

.rw-card[data-kind="weapon"]   { border-left: 3px solid var(--thunder); }
.rw-card[data-kind="weaponup"] { border-left: 3px solid var(--accent); }
.rw-card[data-kind="rest"]     { border-left: 3px solid #6fcf97; }

/* ══ 結算 ════════════════════════════════════════════════════════════ */

.panel-result { width: min(560px, 100%); }
.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  font-family: var(--mono);
}
.rs-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 11px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: .86rem;
}
.rs-row b { color: var(--accent); }
.rs-row.big { grid-column: 1 / -1; }
.rs-row.big b { font-size: 1.3rem; }

/* ══ 遊び方 ═══════════════════════════════════════════════════════════ */

.panel-howto { width: min(720px, 100%); }
.howto-body { overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.howto-body h3 {
  margin: 0 0 6px;
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: .04em;
}
.howto-body p { margin: 0 0 8px; font-size: .89rem; color: var(--fg-dim); }
.howto-body strong { color: var(--fg); }
.howto-list { margin: 0; padding-left: 20px; font-size: .87rem; color: var(--fg-dim); }
.howto-list li { margin: 3px 0; }

/* ══ 書庫 ══════════════════════════════════════════════════════════════ */

.panel-archive { width: min(720px, 100%); }
.archive-ink {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex: none;
  padding: 10px 12px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.archive-ink-label { font-size: .9rem; color: var(--accent); font-weight: 700; }
.archive-ink b { font-family: var(--mono); font-size: 1.4rem; color: var(--accent); }
.archive-ink-note { font-size: .76rem; color: var(--fg-mute); margin-left: auto; }
.archive-ink-note strong { color: var(--fg-dim); }

.archive-body { overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.archive-body h3 { margin: 0 0 8px; font-size: .95rem; color: var(--accent); letter-spacing: .04em; }
.archive-note { margin: 0 0 8px; font-size: .78rem; color: var(--fg-dim); }
.archive-list { display: flex; flex-direction: column; gap: 5px; }

.up-row {
  display: grid;
  grid-template-columns: 4.2rem 3.4rem 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.up-row.can { border-color: rgba(255, 212, 59, .4); }
.up-name { font-size: .88rem; font-weight: 700; }
.up-lv { font-family: var(--mono); font-size: .76rem; color: var(--fg-mute); }
.up-desc { font-size: .76rem; color: var(--fg-dim); }
.up-buy { font-size: .78rem; padding: 6px 11px; }
.up-buy.off { opacity: .45; cursor: not-allowed; }

.archive-words { display: flex; gap: 6px; flex-wrap: wrap; }
.shop-word {
  background: #0b0f18;
  border: 1.5px solid;
  border-radius: var(--r-s);
  color: var(--fg);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 700;
  padding: 8px 12px;
  cursor: pointer;
  transition: background .12s;
}
.shop-word:hover { background: #161e2e; }
.shop-word.can { box-shadow: 0 0 0 2px rgba(255, 212, 59, .22); }
.shop-word.owned { opacity: .55; cursor: default; color: var(--ok); }

/* ══ 辞書 ══════════════════════════════════════════════════════════════ */

/* 辞書パネル。画面の 9 割まで伸びる実高さを持たないと、
   内側の .dict-list (flex: 1) が高さを得られず、362 語ぶんの行が
   画面の下まで垂れ流しになって「反映されていない」ように見える。 */
.panel-dict {
  width: min(780px, 100%);
  height: min(92vh, 820px);
}
.dict-bar { display: flex; gap: 10px; align-items: center; flex: none; }
.dict-bar input {
  flex: 1;
  background: #0b0f18;
  border: 1px solid var(--line-2);
  border-radius: var(--r-s);
  color: var(--fg);
  font-family: inherit;
  font-size: .92rem;
  padding: 9px 12px;
}
.dict-bar input:focus { outline: none; border-color: var(--accent); }
.dict-count { flex: none; font-family: var(--mono); font-size: .78rem; color: var(--fg-mute); }

.dict-tabs { display: flex; gap: 5px; flex-wrap: wrap; flex: none; }
.dict-tab {
  background: transparent;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--fg-dim);
  font-family: inherit;
  font-size: .78rem;
  padding: 4px 11px;
  cursor: pointer;
  transition: background .12s;
}
.dict-tab:hover { background: #161e2e; }
.dict-tab.on { background: #1a2233; border-width: 1.5px; }

.dict-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  /* パネルの中で余った高さを全部使う。これが無いと 362 語ぶんの行が
     画面の外まではみ出し、下の語が見えない (スクロールも効かない)。 */
  flex: 1 1 0;
  min-height: 0;
}
.dict-row {
  display: grid;
  grid-template-columns: 3.4rem 4.6rem 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 7px 9px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
}
.dict-row:hover { background: #121a28; }
.dict-w {
  justify-self: start;
  border: 1.5px solid;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: .95rem;
  font-weight: 700;
}
.dict-cat { font-size: .74rem; }
.dict-fx { font-size: .8rem; color: var(--fg-dim); }
.dict-tags {
  grid-column: 3;
  font-size: .72rem;
  color: var(--fg-mute);
}
.dict-empty { padding: 26px; text-align: center; color: var(--fg-mute); font-size: .9rem; }

/* ══ 設定 ════════════════════════════════════════════════════════════ */

.panel-settings { width: min(480px, 100%); }
.settings-body { display: flex; flex-direction: column; gap: 11px; }
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #0b0f18;
  border: 1px solid var(--line);
  border-radius: var(--r-s);
  font-size: .88rem;
}
.set-row > span { flex: none; width: 90px; }
.set-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.set-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.set-row b { font-family: var(--mono); width: 34px; text-align: right; color: var(--accent); }
.set-row-danger { border-color: rgba(255,84,112,.3); }

/* ══ 狭い画面 ════════════════════════════════════════════════════════ */

@media (max-width: 860px) {
  .forge-body { grid-template-columns: 1fr; }
  .panel-forge { height: 100%; }
  .forge-weapons { max-height: 44vh; }
  .lexicon { grid-template-columns: repeat(5, 1fr); min-height: 110px; }
  .up-row { grid-template-columns: 3.6rem 3rem 1fr auto; }
  .archive-ink-note { display: none; }
  .dict-row { grid-template-columns: 3.2rem 1fr; }
  .dict-cat { justify-self: start; }
  .dict-fx, .dict-tags { grid-column: 2; }
  .hud-timer { font-size: 1.5rem; }
  .hud-top { padding: 8px 10px; gap: 8px; }
  .hud-stats { display: none; }
  .title-record { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 16px; gap: 12px; }
  .result-stats { grid-template-columns: 1fr; }
}

@media (max-height: 560px) {
  .hud-weapons { display: none; }
  .hud-timer { font-size: 1.3rem; }
}

/* スクロールバー */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
*::-webkit-scrollbar-track { background: transparent; }
