/* ============================================================
   Dungeon & Darker — UI
   Aesthetic: forged iron + gold filigree + ember glow + grimoire parchment
   Type: Cinzel (engraved serif) × しっぽり明朝 / Zen Kaku Gothic
   ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  /* 仏教美術：墨・藍・金泥・朱 */
  --ink: #ece1cb;            /* 経文の墨地に金 */
  --ink-dim: #b3a583;
  --muted: #837a63;
  --bg: #0a0a10;             /* 墨×藍の漆黒 */
  --panel: #14131d;
  --panel2: #1c1b27;
  --gold: #c7a24c;           /* 金泥 */
  --gold-bright: #eccd7e;
  --ember: #e8843a;
  --vermilion: #c8402f;      /* 朱 */
  --indigo: #3c4f86;         /* 藍 */
  --jade: #6fae8a;           /* 翡翠 */
  --blood: #b3322a;
  --hp: #c0382e;
  --mp: #4a6fb0;
  --arcane: #8fb6e0;
  --line: #2b2a3a;
  --line2: #534a3a;          /* 金枠の影 */
  --hot: #e8843a;

  --f-display: 'Yuji Syuku', 'Shippori Mincho B1', serif;
  --f-head: 'Shippori Mincho B1', 'Cinzel', serif;
  --f-flavor: 'Shippori Mincho B1', serif;
  --f-body: 'Zen Kaku Gothic New', 'Shippori Mincho B1', sans-serif;

  --shadow: 0 10px 40px rgba(0,0,0,.66), 0 2px 8px rgba(0,0,0,.5);
  --gold-grad: linear-gradient(180deg, #f4e0a4 0%, #d8b15a 48%, #9a7330 100%);
  --gold-line: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold-bright) 50%, var(--gold) 82%, transparent);
  --ease: cubic-bezier(.2,.7,.3,1);
}
html, body { width: 100%; height: 100%; overflow: hidden; background: #000;
  font-family: var(--f-body); color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0;
  background:
    radial-gradient(130% 90% at 50% -12%, rgba(200,64,47,.10), transparent 52%),
    radial-gradient(120% 120% at 50% 120%, rgba(60,79,134,.14), transparent 56%),
    radial-gradient(circle at 50% 42%, #14131f, #08080e 78%);
}
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* atmosphere overlays */
#vignette { position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background:
    radial-gradient(120% 100% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%),
    radial-gradient(100% 60% at 50% 0%, rgba(255,150,60,.05), transparent 60%); }
#grain { position: absolute; inset: 0; pointer-events: none; z-index: 60; opacity: .045; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }

/* ---------- buttons ---------- */
button { font-family: inherit; cursor: pointer; color: var(--ink); }
.btn { font-family: var(--f-head); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase;
  font-size: 12px; color: var(--gold-bright);
  background: linear-gradient(180deg, #2f2615, #17100a 70%, #120b06);
  border: 1px solid var(--line2); border-radius: 3px; padding: 10px 16px;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.14), inset 0 0 14px rgba(0,0,0,.4), 0 2px 0 #000;
  text-shadow: 0 1px 2px #000; transition: transform .12s var(--ease), border-color .15s, box-shadow .2s, color .15s; position: relative; overflow: hidden; }
.btn::after { content: ''; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; pointer-events: none;
  background: linear-gradient(105deg, transparent, rgba(255,235,190,.16), transparent); transform: skewX(-18deg); transition: left .5s var(--ease); }
.btn:hover { border-color: var(--gold); color: #fff8e8;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.24), 0 0 18px rgba(201,162,74,.42), 0 2px 0 #000; }
.btn:hover::after { left: 120%; }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0,0,0,.6); }
.btn:disabled { opacity: .42; cursor: default; filter: grayscale(.6); border-style: dashed; border-color: #3a3326; color: #8a7c5e; }
.btn:disabled::after { display: none; }
.btn.sm { padding: 6px 11px; font-size: 10.5px; letter-spacing: 1px; }
.btn.big { padding: 14px 18px; font-size: 14px; width: 100%; margin: 6px 0; }
.btn.danger { color: #e89086; border-color: #5a241e; background: linear-gradient(180deg, #2a1410, #170a08); }
.btn.danger:hover { border-color: var(--hp); color: #ffd9d2; box-shadow: 0 0 16px rgba(160,40,30,.45), 0 2px 0 #000; }
.btn.poor { color: #9a6a5e; border-color: #4a2a22; }

/* 金泥の細スクロールバー（既定ブラウザ感を消す） */
.town-body::-webkit-scrollbar, #overlay::-webkit-scrollbar, .bag-cols::-webkit-scrollbar { width: 8px; height: 8px; }
.town-body::-webkit-scrollbar-track, #overlay::-webkit-scrollbar-track, .bag-cols::-webkit-scrollbar-track { background: rgba(8,6,3,.5); }
.town-body::-webkit-scrollbar-thumb, #overlay::-webkit-scrollbar-thumb, .bag-cols::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #6a531f, #3a2c12); border-radius: 4px; border: 1px solid #2a2010; }
.town-body::-webkit-scrollbar-thumb:hover, #overlay::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #8a6c28, #4a3818); }
.town-body, #overlay, .bag-cols { scrollbar-width: thin; scrollbar-color: #5a4620 rgba(8,6,3,.5); }

.muted { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.warn { color: #ffb15b; font-size: 12.5px; background: rgba(255,140,40,.07);
  border: 1px solid #50381c; border-left: 3px solid var(--ember); border-radius: 3px; padding: 11px 12px; margin-top: 8px; line-height: 1.6; font-family: var(--f-flavor); }

/* ---------- overlay menus ---------- */
#overlay { position: absolute; inset: 0; display: none; align-items: flex-start; justify-content: center;
  background:
    radial-gradient(130% 90% at 50% -10%, rgba(255,150,60,.08), transparent 55%),
    radial-gradient(ellipse at center, rgba(20,15,8,.93), rgba(5,4,2,.985));
  z-index: 30; padding: clamp(8px, 2vmin, 18px); overflow: auto; -webkit-overflow-scrolling: touch; }
/* 経文・曼荼羅を思わせる極薄の同心円テクスチャ */
#overlay::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background:
    repeating-radial-gradient(circle at 50% 38%, transparent 0 38px, rgba(199,162,76,.035) 38px 39px),
    radial-gradient(circle at 50% 38%, rgba(199,162,76,.05), transparent 60%);
  mask-image: radial-gradient(circle at 50% 38%, #000 30%, transparent 80%); }
#overlay > * { position: relative; z-index: 1; }
.screen { max-width: 1120px; width: 100%; margin: auto; text-align: center; animation: riseIn .5s cubic-bezier(.2,.7,.3,1) both; }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* title（筆文字＋後光） */
.title { font-family: var(--f-display); font-weight: 400; letter-spacing: 8px; line-height: 1;
  font-size: clamp(52px, 12vw, 110px); position: relative; display: inline-block;
  background: linear-gradient(180deg, #f6e2a6 0%, #d4a94e 54%, #9a6f2c 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 1px #2a1c0a) drop-shadow(0 0 30px rgba(220,170,80,.3));
  animation: emberGlow 5s ease-in-out infinite; }
.title::before { content: ''; position: absolute; left: 50%; top: 50%; width: 1.7em; height: 1.7em;
  transform: translate(-50%, -50%); border-radius: 50%; z-index: -1;
  background: radial-gradient(circle, rgba(232,160,70,.22), transparent 68%);
  box-shadow: 0 0 0 1px rgba(199,162,76,.18), 0 0 0 14px rgba(199,162,76,.06); }
@keyframes emberGlow { 0%,100% { filter: drop-shadow(0 2px 1px #2a1c0a) drop-shadow(0 0 24px rgba(220,160,70,.22)); } 50% { filter: drop-shadow(0 2px 1px #2a1c0a) drop-shadow(0 0 38px rgba(236,200,120,.42)); } }
.title span { color: var(--gold); -webkit-text-fill-color: var(--gold-bright); font-family: var(--f-head); font-size: .26em; letter-spacing: 8px; display: block; margin-top: 6px; }
.subtitle { color: var(--ink-dim); margin: 14px auto 26px; font-size: 14px; line-height: 1.9; max-width: 700px; font-family: var(--f-flavor); }
.subtitle::before, .subtitle::after { content: '◆'; color: var(--gold); margin: 0 12px; font-size: .7em; opacity: .7; vertical-align: middle; }

/* class select */
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.class-card { background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line2); border-top: 2px solid var(--ac); border-radius: 4px; padding: 13px; text-align: left;
  position: relative; transition: .18s; box-shadow: var(--shadow);
  animation: riseIn .5s cubic-bezier(.2,.7,.3,1) both; }
.class-card:nth-child(2) { animation-delay: .05s; } .class-card:nth-child(3) { animation-delay: .1s; }
.class-card:nth-child(4) { animation-delay: .15s; } .class-card:nth-child(5) { animation-delay: .2s; }
.class-card:nth-child(6) { animation-delay: .25s; } .class-card:nth-child(7) { animation-delay: .3s; }
.class-card:nth-child(8) { animation-delay: .35s; } .class-card:nth-child(9) { animation-delay: .4s; }
.class-card::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(201,162,74,.14); border-radius: 2px; pointer-events: none; }
.class-card:hover { transform: translateY(-4px); border-color: var(--ac);
  box-shadow: 0 14px 38px rgba(0,0,0,.6), 0 0 24px color-mix(in srgb, var(--ac) 35%, transparent); }
.cc-name { font-family: var(--f-head); font-size: 23px; font-weight: 700; color: var(--ac); letter-spacing: 1px; }
.cc-weap { font-size: 11px; color: var(--gold); margin: 4px 0 9px; letter-spacing: .5px; }
.cc-blurb { font-size: 12px; color: var(--ink-dim); line-height: 1.55; font-family: var(--f-flavor); }
.cc-stats { display: flex; flex-wrap: wrap; gap: 4px 9px; font-size: 11px; color: var(--muted); margin: 12px 0; }
.cc-skills { font-size: 12px; color: var(--ink-dim); margin-bottom: 14px; min-height: 18px; }
.class-card .pick { width: 100%; }
.class-card { text-align: center; }
.cc-stats { justify-content: center; }
.cc-skills { text-align: center; }
.cc-av { width: 56px; height: 64px; image-rendering: pixelated; display: block; margin: 0 auto 6px;
  background: radial-gradient(circle at 50% 42%, rgba(199,162,76,.16), transparent 70%); }
.class-card.cur { border-color: var(--gold-bright); box-shadow: 0 0 22px rgba(236,205,126,.28), 0 10px 30px rgba(0,0,0,.5); }
.class-tab { padding: 2px; }

/* ブランド（初回・道タブ） */
.brand { font-family: var(--f-display); font-size: 24px; letter-spacing: 6px; color: var(--gold-bright); }
.brand span { font-family: var(--f-head); font-size: 12px; letter-spacing: 3px; color: var(--gold); margin-left: 10px; }
.town-gold.subtle { font-family: var(--f-flavor); color: var(--ink-dim); font-weight: 400; font-size: 12px; }

/* キャラパネル（己タブ） */
.char-card { display: flex; gap: 14px; align-items: center; }
.avatar-frame { flex-shrink: 0; width: 96px; height: 108px; border-radius: 4px; position: relative;
  background: radial-gradient(circle at 50% 38%, rgba(199,162,76,.2), rgba(8,8,14,.6) 72%);
  border: 1px solid var(--line2); box-shadow: inset 0 0 24px rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; }
.avatar-frame::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(199,162,76,.22); border-radius: 3px; }
.avatar { image-rendering: pixelated; }
.char-meta { flex: 1; min-width: 0; }
.char-name { font-family: var(--f-head); font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.char-sub { font-size: 11px; color: var(--gold); margin: 3px 0 7px; }
.char-flavor { font-size: 12px; color: var(--ink-dim); line-height: 1.6; font-family: var(--f-flavor); }
.char-rec { font-size: 11px; color: var(--muted); margin-top: 8px; letter-spacing: .5px; }

/* ---------- town ---------- */
.town { width: 100%; max-width: 1100px; height: auto; max-height: 96vmin; margin: auto; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 5px; overflow: hidden;
  box-shadow: var(--shadow); animation: riseIn .45s cubic-bezier(.2,.7,.3,1) both; position: relative; }
.town::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(201,162,74,.12); border-radius: 3px; pointer-events: none; z-index: 1; }
.town-top { position: relative; flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 20px;
  background: linear-gradient(180deg, #1b1727, #110f1a); border-bottom: 1px solid var(--line2); }
.town-top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--gold-line); opacity: .5; }
.town-title { position: relative; font-family: var(--f-head); font-size: 16px; font-weight: 600; letter-spacing: 1px; color: var(--ink); flex: 1; min-width: 0; overflow-wrap: anywhere; padding-left: 14px; }
.town-title::before { content: ''; position: absolute; left: 0; top: 50%; width: 6px; height: 6px; transform: translateY(-50%) rotate(45deg); background: var(--gold-grad); box-shadow: 0 0 8px rgba(201,162,74,.5); }
.town-gold { flex-shrink: 0; }
.town-title b { font-family: var(--f-head); }
.town-title .lvl { color: var(--gold-bright); margin-left: 8px; font-size: 13px; }
.town-gold { font-family: var(--f-head); color: var(--gold-bright); font-weight: 700; font-size: 16px; letter-spacing: .5px; text-shadow: 0 0 10px rgba(201,162,74,.4); }
.town-nav { flex: 0 0 auto; display: flex; gap: 2px; padding: 8px 12px 0; background: linear-gradient(180deg, #130d07, #0c0805); border-bottom: 1px solid var(--line2); box-shadow: inset 0 -1px 0 rgba(199,162,76,.1); flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.town-nav::-webkit-scrollbar { height: 0; display: none; }
.tnav { position: relative; flex: 0 0 auto; white-space: nowrap; font-family: var(--f-head); background: transparent; border: 1px solid transparent; border-bottom: none; border-radius: 4px 4px 0 0; padding: 8px 15px 10px; font-size: 12.5px; font-weight: 600; letter-spacing: 1px; color: var(--muted); transition: color .14s, background .18s; }
.tnav:hover { color: var(--gold-bright); }
.tnav::after { content: ''; position: absolute; left: 50%; bottom: 1px; width: 0; height: 2px; background: var(--gold-line); transform: translateX(-50%); transition: width .22s var(--ease); border-radius: 2px; }
.tnav.on { color: var(--gold-bright); background: linear-gradient(180deg, rgba(58,46,22,.55), rgba(20,15,8,0)); border-color: var(--line2); }
.tnav.on::after { width: 78%; box-shadow: 0 0 9px rgba(236,205,126,.65); }
.town-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 16px; position: relative; z-index: 2; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }

.card { background: linear-gradient(180deg, rgba(40,31,18,.7), rgba(24,18,10,.7)); border: 1px solid var(--line); border-radius: 4px; padding: 15px; margin-bottom: 12px; position: relative;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.05), inset 0 0 26px rgba(0,0,0,.35); }
.card h3 { font-family: var(--f-head); font-size: 12.5px; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 12px; color: var(--gold-bright);
  display: flex; align-items: center; gap: 9px; }
.card h3::before { content: '◆'; color: var(--gold); font-size: 8px; opacity: .8; flex-shrink: 0; }
.card h3::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line2) 0%, rgba(199,162,76,.25) 30%, transparent); }

/* status */
.lvbox { display: flex; align-items: center; gap: 11px; font-family: var(--f-head); font-weight: 700; margin-bottom: 12px; font-size: 15px; color: var(--gold-bright); }
.xpbar { flex: 1; height: 9px; background: #0a0704; border-radius: 5px; overflow: hidden; border: 1px solid var(--line2); box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.xpbar > div { height: 100%; background: linear-gradient(90deg, #7a5a22, #d4a94e, #f0cf80); box-shadow: 0 0 8px rgba(201,162,74,.5); }
.lvbox span { font-size: 11px; color: var(--muted); font-weight: 400; font-family: var(--f-body); }
.points { margin-bottom: 10px; font-size: 13px; }
.points b { color: var(--muted); } .points b.hot { color: var(--ember); font-size: 18px; font-family: var(--f-head); text-shadow: 0 0 10px rgba(255,138,60,.5); }
.attr-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(90,74,40,.25); }
.attr-info { flex: 1; } .attr-info b { font-size: 14px; font-family: var(--f-flavor); }
.attr-info .ak { font-size: 10px; color: var(--gold); margin-left: 6px; font-family: var(--f-head); }
.attr-info .ad { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.attr-val { font-family: var(--f-head); font-size: 21px; font-weight: 700; width: 34px; text-align: center; color: var(--ink); }
.drow { display: flex; justify-content: space-between; padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid rgba(90,74,40,.18); }
.drow b { color: var(--gold-bright); font-family: var(--f-head); }
/* 戦型と装束（ビルド深度） */
.syn-head { margin-top: 11px; font-family: var(--f-head); font-size: 11px; letter-spacing: 1px; color: var(--gold); text-transform: uppercase; }
.syn-list { margin-top: 5px; display: flex; flex-direction: column; gap: 5px; }
.syn { display: flex; gap: 9px; align-items: baseline; font-size: 11.5px; line-height: 1.4; }
.syn b { color: var(--ember); font-family: var(--f-flavor); flex-shrink: 0; min-width: 34px; }
.syn span { color: var(--muted); }

/* equipment / inventory */
.equip-cols { align-items: stretch; }
.equip-cols .col { min-width: 0; }
.be-note { font-size: 11px; margin: -4px 0 10px; }
.equip-inv-card { display: flex; flex-direction: column; max-height: min(72vh, 520px); }
.inv-scroll { overflow-y: auto; flex: 1; min-height: 120px; padding-right: 4px; }
/* 装備タブ：人体シルエット */
.body-equip { position: relative; max-width: 280px; margin: 0 auto; padding: 4px 0 8px; }
.be-silhouette { position: absolute; left: 50%; top: 36px; width: 68px; height: 158px; transform: translateX(-50%);
  border-radius: 34px 34px 22px 22px; background: linear-gradient(180deg, rgba(70,58,36,.14), rgba(28,22,12,.4));
  border: 1px dashed rgba(130,108,62,.4); pointer-events: none; z-index: 0; box-shadow: inset 0 0 24px rgba(0,0,0,.35); }
.be-head { position: relative; z-index: 1; display: flex; justify-content: center; margin-bottom: 6px; }
.be-mid { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; }
.be-side { flex: 0 0 88px; }
.be-core { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.be-acc { position: relative; z-index: 1; display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; }
.be-pots { position: relative; z-index: 1; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; padding-top: 6px; border-top: 1px solid rgba(90,74,40,.22); }
.be-slot { background: rgba(12,9,5,.65); border: 1px solid var(--line); border-radius: 4px; padding: 5px 6px; min-height: 52px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.be-slot .be-lbl { font-size: 9px; color: var(--gold); font-family: var(--f-head); letter-spacing: .5px; }
.be-filled { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 100%; }
.be-ic { width: 32px; height: 32px; image-rendering: pixelated; object-fit: contain;
  border: 1px solid color-mix(in srgb, var(--rc, #c7a24c) 45%, #2a2433); border-radius: 3px; padding: 2px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc, #c7a24c) 20%, transparent), rgba(10,9,14,.5) 72%); }
.be-empty { width: 32px; height: 32px; border-radius: 3px; border: 1px dashed rgba(90,74,40,.45); background: rgba(8,6,4,.4); }
.be-pot { min-width: 72px; }
.be-slot .btn.sm { padding: 2px 8px; font-size: 10px; }
.eq-slot { display: flex; align-items: center; gap: 10px; padding: 9px; background: rgba(12,9,5,.5); border: 1px solid var(--line); border-radius: 3px; margin-bottom: 6px; }
.eq-name { width: 88px; font-size: 11px; color: var(--gold); flex-shrink: 0; font-family: var(--f-head); letter-spacing: .5px; }
.eq-item { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.eq-stat { font-size: 11px; color: #9fc89a; width: 100%; font-family: var(--f-body); }
.eq-empty { flex: 1; color: #5a4e3a; font-size: 12px; font-style: italic; }
.inv-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px; border-bottom: 1px solid rgba(90,74,40,.2); flex-wrap: wrap; }
.inv-act { display: flex; align-items: center; gap: 6px; }
.slot-tag { font-size: 10px; color: var(--ink-dim); background: #0c0904; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); font-family: var(--f-head); }
.slot-tag.lock { color: #d98a6a; border-color: #5a2c22; background: #1c0e0a; }
.inv-row.lockrow { opacity: .68; }
.val { font-size: 12px; color: var(--gold-bright); font-family: var(--f-head); }
.rar { font-weight: 700; font-size: 13px; font-family: var(--f-flavor); overflow-wrap: anywhere; }
/* コイン表記 */
.coin-i { width: 16px; height: 16px; image-rendering: pixelated; vertical-align: -3px; }
.gold-amt { display: inline-flex; align-items: center; gap: 3px; }
.town-gold .coin-i { width: 19px; height: 19px; }
.runinfo .coin-i { width: 12px; height: 12px; vertical-align: -1px; margin-right: 1px; }

/* ステータスを2カラム化＝スクロール削減 */
.attr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.attr-grid .attr-row { padding: 6px 0; border-bottom: 1px solid rgba(90,74,40,.16); }
.drow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.ach-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ach-chip { font-size: 11px; padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); opacity: .55; }
.ach-chip.got { opacity: 1; color: var(--gold-bright); border-color: var(--line2); background: rgba(120,90,30,.14); }

.item-line { display: inline-flex; align-items: center; gap: 7px; vertical-align: middle; }
.item-icon { width: 28px; height: 28px; flex-shrink: 0; image-rendering: pixelated; object-fit: contain;
  border: 1px solid color-mix(in srgb, var(--rc, #c7a24c) 45%, #2a2433); border-radius: 4px; padding: 2px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc, #c7a24c) 24%, transparent), rgba(10,9,14,.5) 72%);
  box-shadow: inset 0 0 6px rgba(0,0,0,.4); }
/* 折り返し安全策（はみ出し防止） */
.cc-blurb, .char-flavor, .sc-desc, .muted, .eq-stat, .inv-row > div, .res-item, .modal-msg { overflow-wrap: anywhere; word-break: normal; }
.inv-row { min-width: 0; }
.inv-row > div { min-width: 0; flex: 1; }

/* skill select */
.skill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.skill-card { background: linear-gradient(180deg, rgba(40,31,18,.55), rgba(18,13,7,.55)); border: 1px solid var(--line); border-radius: 4px; padding: 13px; transition: .15s; position: relative; }
.skill-card.on { border-color: var(--gold); box-shadow: 0 0 16px rgba(201,162,74,.28), inset 0 0 20px rgba(120,80,20,.18); }
.sc-top { display: flex; align-items: center; gap: 9px; font-family: var(--f-flavor); font-size: 15px; font-weight: 700; color: var(--ink); }
.sc-ic { font-size: 22px; }
.sc-meta { font-size: 11px; color: var(--arcane); margin: 5px 0; }
.sc-desc { font-size: 12px; color: var(--muted); line-height: 1.55; min-height: 36px; margin-bottom: 9px; font-family: var(--f-flavor); }
.skill-card .btn { width: 100%; }

/* compare */
.cmp-line { font-size: 11px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.cmp.up { color: #7fe08a; } .cmp.down { color: #ff7a6a; } .cmp.new { color: var(--gold-bright); } .cmp { color: var(--muted); }

/* achievements & bounties */
.ach { display: flex; flex-direction: column; padding: 7px 0; border-bottom: 1px solid rgba(90,74,40,.18); opacity: .45; }
.ach.got { opacity: 1; }
.ach b { font-size: 13px; font-family: var(--f-flavor); } .ach.got b { color: var(--gold-bright); }
.ach span { font-size: 11px; color: var(--muted); }
.brow { display: flex; justify-content: space-between; align-items: center; }

/* result */
.result { max-width: 660px; position: relative; }
.result .res-title, .result .subtitle, .result .res-stats, .result .card, .result .btn { position: relative; z-index: 1; }
.samsara { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 210px; height: 210px; pointer-events: none; opacity: .5; z-index: 0; }
.samsara span { position: absolute; inset: 0; border-radius: 50%; }
.samsara span:nth-child(1) { border: 1px dashed rgba(200,64,47,.55); animation: spin 16s linear infinite; }
.samsara span:nth-child(2) { inset: 26px; border: 1px solid rgba(199,162,76,.5); animation: spin 11s linear infinite reverse; }
.samsara span:nth-child(3) { inset: 54px; border: 1px dashed rgba(124,110,166,.55); animation: spin 22s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.res-title { font-family: var(--f-display); font-size: 44px; font-weight: 900; letter-spacing: 3px; margin-bottom: 6px; }
.result.win .res-title { color: var(--gold-bright); text-shadow: 0 0 30px rgba(201,162,74,.5); }
.result.lose .res-title { color: var(--hp); text-shadow: 0 0 30px rgba(160,40,30,.5); }
.res-stats { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 18px 0; }
.res-stats > div { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 4px; padding: 12px 18px; min-width: 92px; }
.res-stats span { display: block; font-size: 11px; color: var(--muted); letter-spacing: 1px; font-family: var(--f-head); text-transform: uppercase; }
.res-stats b { font-size: 24px; color: var(--ink); font-family: var(--f-head); } .res-stats b.hot { color: var(--ember); }
.res-item { display: inline-block; margin: 4px; padding: 7px 11px; background: rgba(20,15,8,.7); border: 1px solid var(--line); border-radius: 3px; }
.card.lost { border-color: #5a241e; } .card.lost h3 { color: var(--hp); }
/* 解脱（NG+）リザルト */
.result.liberated .res-title { color: #fff; text-shadow: 0 0 44px rgba(255,240,200,.85), 0 0 14px rgba(255,255,255,.6); }
.result.liberated .samsara { opacity: .85; }
.result.liberated .samsara span:nth-child(1) { border-color: rgba(255,240,200,.7); }
.result.liberated .samsara span:nth-child(2) { border-color: rgba(255,255,255,.75); }
.result.liberated .samsara span:nth-child(3) { border-color: rgba(255,224,170,.7); }
/* 徳タブのメタ表示 */
.virtue-meta { display: flex; gap: 14px; margin-bottom: 12px; }
.vm { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 4px; padding: 8px 18px; min-width: 84px; text-align: center; }
.vm span { display: block; font-size: 10px; color: var(--muted); letter-spacing: 1px; font-family: var(--f-head); text-transform: uppercase; }
.vm b { font-size: 23px; font-family: var(--f-head); color: var(--ink); } .vm b.hot { color: var(--gold-bright); text-shadow: 0 0 10px rgba(236,205,126,.5); }
.exlabel.liber { color: #fff; text-shadow: 0 0 14px rgba(255,240,200,.85); }
/* スコア / ランク / 称号 */
.rankrow { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 6px 0 2px; }
.rankbadge { font-family: var(--f-head); font-weight: 800; font-size: 40px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; border-radius: 8px; border: 2px solid var(--line2); background: linear-gradient(180deg, var(--panel2), var(--panel)); text-shadow: 0 0 16px currentColor; }
.r-S { color: #ffe07a; border-color: #caa14a; box-shadow: 0 0 26px rgba(236,205,126,.55); }
.r-A { color: #ff9a6a; border-color: #a8552c; }
.r-B { color: #9fd0ff; border-color: #3c6486; }
.r-C { color: #bcd0a0; border-color: #5a6a40; }
.r-D { color: #b0a890; border-color: #4a4438; }
.scoreval { font-family: var(--f-head); font-size: 30px; font-weight: 700; color: var(--gold-bright); }
.scoreval small { font-size: 14px; color: var(--muted); margin-left: 3px; }
.bestline { font-size: 12px; color: var(--ink-dim); font-family: var(--f-head); margin-bottom: 8px; }
.newrec { color: #7fe08a; font-weight: 700; margin-left: 6px; }
.title-tag { display: inline-block; margin-left: 10px; font-family: var(--f-flavor); font-size: 12px; color: var(--gold-bright); border: 1px solid var(--line2); border-radius: 10px; padding: 1px 10px; vertical-align: middle; background: rgba(120,90,30,.16); }

/* ===== バッグ（マス制インベントリ） ===== */
.bag-screen { width: 100%; max-width: 980px; max-height: 96vmin; margin: auto; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 5px; overflow: hidden; box-shadow: var(--shadow); }
.bag-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: linear-gradient(180deg, #1a1726, #110f1a); border-bottom: 1px solid var(--line2); }
.bag-top b { font-family: var(--f-head); font-size: 16px; color: var(--gold-bright); }
.bag-top .bagclose { margin-left: auto; }
/* 拾うアイテム=左／自分のバッグ=右 を常に維持（縦持ちは#appを回転させており、
   ビューポート幅基準のメディアクエリでは段組みが壊れるため2カラム固定） */
.bag-cols { display: grid; grid-template-columns: 1fr 1.15fr; gap: 10px; padding: 12px; overflow: auto; align-items: start; }
.eq-sub { margin-top: 14px !important; }
.eqgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.bag-pane { background: rgba(12,9,5,.4); border: 1px solid var(--line); border-radius: 4px; padding: 12px; }
.bag-pane h3 { font-family: var(--f-head); font-size: 12px; letter-spacing: 1px; color: var(--gold-bright); margin-bottom: 10px; text-transform: uppercase; }
.loot-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(90,74,40,.18); flex-wrap: wrap; }
/* 高さは aspect-ratio で決まる。max-height だと 1fr 行と矛盾して下にはみ出すため、
   高さの上限は「幅」で制御する（min(px, vmin) で短い画面でも収まる） */
.bag-grid { display: grid; gap: 3px; width: 100%; max-width: min(360px, 82vmin); margin: 0 auto; position: relative; padding: 6px;
  background: linear-gradient(180deg, rgba(22,15,8,.55), rgba(10,7,4,.55)); border: 1px solid var(--line2); border-radius: 6px;
  box-shadow: inset 0 0 20px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,220,150,.06); }
.stash-grid { max-width: min(520px, 96vmin); }
.bag-cell { background: rgba(8,8,14,.55); border: 1px solid rgba(90,74,40,.26); border-radius: 3px; cursor: pointer; box-shadow: inset 0 0 6px rgba(0,0,0,.4); }
.bag-cell.drop { background: rgba(95,170,120,.24); border-color: #6fae8a; box-shadow: inset 0 0 8px rgba(110,200,140,.35); }
.bag-cell.bad { background: rgba(180,50,40,.22); border-color: #b6322c; }
.bag-item.dragging { opacity: .4; }
.bag-item, .bag-cell { touch-action: none; }
.bag-item { border: 1px solid color-mix(in srgb, var(--rc, #c7a24c) 50%, #2a2433); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; margin: 1px;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--rc, #c7a24c) 22%, transparent), rgba(8,8,14,.55) 72%); }
.bag-item.sel { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(236,205,126,.55); }
.bag-item.moving { opacity: .4; }
.bag-ic { width: 82%; height: 82%; image-rendering: pixelated; object-fit: contain; }
.loot-row .sz { font-size: 10px; color: var(--muted); font-family: var(--f-head); margin-left: auto; }
.bag-actions { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line); }
.eqrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid rgba(90,74,40,.18); flex-wrap: wrap; }
.eqrow .eqlbl { width: 48px; font-size: 11px; color: var(--gold); font-family: var(--f-head); flex-shrink: 0; }
.eqrow .unequip { margin-left: auto; }

/* ============================================================
   HUD
   ============================================================ */
#hud { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 20; }
#hud button, #skillbar button { pointer-events: auto; }
#dmgflash { position: absolute; inset: 0; background: radial-gradient(ellipse at center, transparent 38%, rgba(170,20,16,.6)); opacity: 0; transition: opacity .12s; pointer-events: none; }
/* 低HP：画面端が赤く脈打つ緊張演出（不透明度はJSで制御） */
#lowhp { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(180,20,16,.85) 100%); }

.hud-vitals { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(64px, calc(env(safe-area-inset-left) + 58px)); width: min(280px, 42vw); }
/* 左上：バッグ */
.bagbtn { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(10px, env(safe-area-inset-left));
  width: 50px; height: 50px; border-radius: 8px; background: linear-gradient(180deg, #2a2114, #160f08); border: 1px solid var(--line2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: auto;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.12), 0 2px 0 #000; }
.bagbtn .bag-ic { font-family: var(--f-head); font-size: 16px; font-weight: 700; color: var(--gold-bright); line-height: 1; display: flex; align-items: center; justify-content: center; }
.bag-ic-img { width: 28px; height: 28px; image-rendering: pixelated; object-fit: contain; }
.bagbtn .bag-ct { font-size: 10px; color: var(--ink-dim); font-family: var(--f-head); }
.bagbtn:active { transform: scale(.94); }
/* 右下：松明（タップで点灯／長押しで設置） */
.torchbtn { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom));
  width: clamp(48px, 10vmin, 56px); height: clamp(48px, 10vmin, 56px); border-radius: 8px;
  background: linear-gradient(180deg, #2a2114, #160f08); border: 1px solid var(--line2);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 1px; pointer-events: auto; touch-action: none;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.12), 0 2px 0 #000; z-index: 24; }
.torchbtn .torch-ic { font-family: var(--f-head); font-size: 13px; font-weight: 700; color: var(--muted); line-height: 1; }
.torchbtn .torch-st { font-size: 8px; color: var(--ink-dim); font-family: var(--f-head); text-align: center; line-height: 1.15; max-width: 94%; }
.torchbtn:active { transform: scale(.94); }
.torchbtn.lit { border-color: #c87830; box-shadow: inset 0 1px 0 rgba(255,200,120,.2), 0 0 18px rgba(232,132,58,.45), 0 2px 0 #000; }
.torchbtn.lit .torch-ic { color: var(--ember); text-shadow: 0 0 10px rgba(232,132,58,.65); }
.torchbtn.thrown { opacity: .55; border-style: dashed; }
.torchbtn.thrown .torch-ic { color: var(--muted); text-shadow: none; }
.vital { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.vlabel { font-family: var(--f-head); font-size: 11px; font-weight: 700; width: 22px; letter-spacing: .5px; }
.hp .vlabel { color: #e0786a; } .mp .vlabel { color: #6fb0e6; }
.vbar { position: relative; flex: 1; height: 17px; background: #0a0604; border: 1px solid #000; border-radius: 3px; overflow: hidden;
  box-shadow: inset 0 1px 4px rgba(0,0,0,.7), 0 0 0 1px var(--line2); }
.vfill { height: 100%; width: 100%; transition: width .18s; position: relative; }
.hp .vfill { background: linear-gradient(180deg, #e07064, #9e2b22); }
.mp .vfill { background: linear-gradient(180deg, #6fb6f0, #2c63a8); }
.vfill::after { content: ''; position: absolute; inset: 0 0 50% 0; background: linear-gradient(180deg, rgba(255,255,255,.25), transparent); }
.vbar span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--f-head); text-shadow: 0 1px 2px #000; color: #fff; }
.runinfo { display: inline-flex; align-items: center; font-size: 11px; color: var(--gold-bright); margin-top: 6px; text-shadow: 0 1px 3px #000; font-family: var(--f-head); letter-spacing: .3px; white-space: nowrap;
  background: linear-gradient(180deg, rgba(24,18,10,.7), rgba(12,9,5,.7)); border: 1px solid var(--line2); border-radius: 4px; padding: 3px 9px; box-shadow: inset 0 1px 0 rgba(255,220,150,.08); }


/* 闇の侵食タイマー：通常は左カラム（HP/MPの下）に左寄せ。HP/MPバーと衝突させない */
#zoneinfo { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 66px); left: max(64px, calc(env(safe-area-inset-left) + 58px)); text-align: left;
  font-family: var(--f-head); font-size: 12px; font-weight: 600; letter-spacing: .5px; color: #c79bff; text-shadow: 0 1px 5px #000; pointer-events: none; white-space: nowrap; transition: top .2s var(--ease), left .2s var(--ease); }
/* 侵食開始＝最重要警告。中央へ昇格し赤朱の札で大きく（HP/MPの下に来るよう少し下げる）。
   id+class で #zoneinfo の left を確実に上書き（はみ出し防止） */
#zoneinfo.warn { top: calc(max(10px, env(safe-area-inset-top)) + 104px); left: 50%; right: auto; transform: translateX(-50%); text-align: center;
  white-space: normal; max-width: 86vw; font-size: clamp(14px, 3.1vmin, 20px); letter-spacing: 2px; color: #ffe2da;
  background: linear-gradient(180deg, rgba(120,22,18,.95), rgba(70,12,10,.95)); border: 1px solid var(--vermilion); border-radius: 4px;
  padding: 7px 16px; box-shadow: 0 0 24px rgba(200,64,47,.5), inset 0 1px 0 rgba(255,220,150,.15);
  animation: zonePulse .8s ease-in-out infinite; }
.karmainfo { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 88px); left: max(64px, calc(env(safe-area-inset-left) + 58px));
  display: none; font-family: var(--f-head); font-size: 11px; font-weight: 600; letter-spacing: .3px; color: #ff7a5a; text-shadow: 0 1px 4px #000; pointer-events: none; max-width: min(58vw, 280px); line-height: 1.5; }
.karmainfo .lib-ok { color: #ffe6a8; text-shadow: 0 0 8px rgba(236,205,126,.7); }
.karmainfo .lib-no { color: #c79bff; }
.karmainfo .lib-dim { color: var(--ink-dim); font-weight: 400; }
@keyframes zonePulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

#extract { position: absolute; top: 36%; left: 50%; transform: translateX(-50%); display: none; text-align: center; pointer-events: none; }
.exlabel { font-family: var(--f-head); color: #aee7ff; font-weight: 600; letter-spacing: 1px; margin-bottom: 7px; text-shadow: 0 2px 8px #000; }
.exbar { width: 230px; height: 13px; background: #0a0604; border: 1px solid #000; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line2); }
.exbar > div { height: 100%; background: linear-gradient(90deg, #2c63a8, #aee7ff); }

/* スキル＆ポーションは右スティックの周囲に弧状配置 */
#skillbar { position: absolute; right: 13%; bottom: 25%; width: 0; height: 0;
  --skr: clamp(112px, 22vmin, 148px); pointer-events: none; }
/* 背の低い横画面（スマホ）：スティックのドラッグ域＋指に被らないよう半径を確保 */
@media (max-height: 430px) { #skillbar { --skr: clamp(108px, 27vmin, 134px); bottom: 27%; } }
#skillbar .skbtn, #skillbar .potbtn { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; touch-action: none; }
.skbtn { position: relative; width: clamp(44px, 8.6vmin, 58px); height: clamp(44px, 8.6vmin, 58px); border-radius: 6px;
  background: linear-gradient(180deg, #221a0e, #120c06); border: 2px solid var(--line2);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.1), inset 0 0 14px rgba(0,0,0,.5); }
.skbtn.sel { border-color: var(--gold-bright); box-shadow: 0 0 18px rgba(236,200,121,.6), 0 0 0 2px rgba(236,205,126,.25), inset 0 0 16px rgba(120,80,20,.32); background: linear-gradient(180deg, #3a2c14, #1e150a); }
#skillbar .skbtn.sel { transform: translate(-50%, -50%) scale(1.08); }
.skbtn.dis { opacity: .42; filter: grayscale(.4); }
.skic { font-size: clamp(17px, 3.4vmin, 22px); line-height: 1; display: flex; align-items: center; justify-content: center; }
.sk-i { width: clamp(22px, 4.4vmin, 30px); height: clamp(22px, 4.4vmin, 30px); image-rendering: pixelated; object-fit: contain; }
.sc-ic .sk-i { width: 26px; height: 26px; } .sklbl { font-size: clamp(9px, 1.7vmin, 10px); color: var(--ink); font-family: var(--f-flavor); line-height: 1.05; } .skmp { font-size: clamp(8px, 1.5vmin, 9px); color: var(--arcane); font-family: var(--f-head); }
.skcd { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(15px, 3vmin, 20px); font-weight: 800; font-family: var(--f-head); background: rgba(0,0,0,.6); border-radius: 4px; color: var(--gold-bright); }
.potbtn { width: clamp(44px, 8vmin, 52px); height: clamp(44px, 8vmin, 52px); border-radius: 6px; background: linear-gradient(180deg, #221a0e, #120c06); border: 2px solid var(--line2); display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: inset 0 0 12px rgba(0,0,0,.5); }
.potbtn.empty { opacity: .38; } .potic { font-size: clamp(13px, 2.6vmin, 16px); font-family: var(--f-head); } .potlbl { font-size: clamp(8px, 1.5vmin, 9px); color: var(--ink-dim); }
.potic-img { width: clamp(22px, 4.6vmin, 30px); height: clamp(22px, 4.6vmin, 30px); image-rendering: pixelated; object-fit: contain; }

/* インタラクト＝御札（おふだ）風。墨地に金枠＋朱の角印で世界観に馴染ませる */
.interactbtn { position: absolute; bottom: calc(max(14px, env(safe-area-inset-bottom)) + clamp(82px, 17vmin, 110px)); left: 50%; transform: translateX(-50%);
  display: none; font-family: var(--f-head); background: linear-gradient(180deg, rgba(40,30,16,.96), rgba(20,14,8,.96));
  border: 1px solid var(--gold); color: var(--gold-bright); border-radius: 4px;
  padding: 11px 24px; font-size: 14px; font-weight: 600; letter-spacing: 3px; pointer-events: auto;
  box-shadow: inset 0 1px 0 rgba(255,220,150,.16), 0 0 16px rgba(201,162,74,.32), 0 3px 0 #000; text-shadow: 0 1px 2px #000; }
.interactbtn::before { content: ''; position: absolute; inset: 3px; border: 1px solid rgba(201,162,74,.28); border-radius: 2px; pointer-events: none; }
.interactbtn::after { content: ''; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; transform: translateY(-50%) rotate(45deg); background: var(--vermilion); box-shadow: 0 0 6px rgba(200,64,47,.6); }
.interactbtn.go { border-color: var(--vermilion); color: #ffe7d8; box-shadow: inset 0 1px 0 rgba(255,220,150,.16), 0 0 20px rgba(200,64,47,.5), 0 3px 0 #000; animation: zonePulse 1s ease-in-out infinite; }
.interactbtn.go::after { background: var(--gold-bright); box-shadow: 0 0 8px rgba(236,205,126,.7); }

.hint { display: none; }

#toast { position: absolute; top: 13%; left: 50%; transform: translateX(-50%); background: linear-gradient(180deg, rgba(24,18,10,.95), rgba(12,9,5,.95)); border: 1px solid var(--gold); color: var(--gold-bright); padding: 9px 20px; border-radius: 3px; font-size: 13px; font-weight: 600; font-family: var(--f-flavor); opacity: 0; transition: opacity .3s; z-index: 40; pointer-events: none; max-width: min(86vw, 420px); text-align: center; line-height: 1.5; overflow-wrap: anywhere; box-shadow: 0 4px 20px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,220,150,.12); }

/* ゲーム内モーダル（ブラウザの confirm を使わない） */
#modal { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 55; padding: 20px;
  background: radial-gradient(ellipse at center, rgba(10,8,14,.72), rgba(4,3,8,.86)); }
.modal-box { position: relative; width: 100%; max-width: 440px; text-align: center; padding: 24px 22px;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line2); border-radius: 5px; box-shadow: var(--shadow);
  animation: riseIn .25s ease both; }
.modal-box::before { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(199,162,76,.18); border-radius: 3px; pointer-events: none; }
.modal-msg { font-family: var(--f-flavor); font-size: 14px; line-height: 1.85; color: var(--ink); white-space: pre-line; margin-bottom: 20px; overflow-wrap: anywhere; }
.modal-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.modal-btns .btn { min-width: 116px; }
.modal-yes { border-color: var(--vermilion); color: #f0b6aa; }
.modal-yes:hover { border-color: #e0584a; color: #ffe2da; box-shadow: 0 0 16px rgba(200,64,47,.4), 0 2px 0 #000; }

/* ---------- スタート画面 ---------- */
/* スタート画面：常に1画面に収め、スクロールさせない */
#overlay.locked { overflow: hidden !important; align-items: center; padding: 0; }
.start-screen { max-width: 760px; width: 100%; height: 100%; margin: auto; text-align: center; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden;
  padding: 2vmin 16px; gap: 1px;
  animation: riseIn .6s cubic-bezier(.2,.7,.3,1) both; }
.start-wheel { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -54%); width: min(58vmin, 360px); height: min(58vmin, 360px); pointer-events: none; opacity: .42; z-index: 0; }
.start-wheel span { position: absolute; inset: 0; border-radius: 50%; }
.start-wheel span:nth-child(1) { border: 1px dashed rgba(200,64,47,.5); animation: spin 24s linear infinite; }
.start-wheel span:nth-child(2) { inset: 14%; border: 1px solid rgba(199,162,76,.5); animation: spin 16s linear infinite reverse; }
.start-wheel span:nth-child(3) { inset: 30%; border: 1px dashed rgba(124,110,166,.55); animation: spin 34s linear infinite; }
.start-mark { position: relative; z-index: 1; font-family: var(--f-display); letter-spacing: 8px; font-size: clamp(11px, 2.4vmin, 13px); color: var(--gold); opacity: .8; margin-bottom: clamp(4px, 1.4vmin, 10px); }
.start-title { position: relative; z-index: 1; font-size: clamp(46px, 13vmin, 118px); margin: 0; }
.start-screen .subtitle { position: relative; z-index: 1; margin: clamp(8px, 2vmin, 22px) auto; font-size: clamp(12px, 2.4vmin, 14px); }
.start-screen .startbtn { position: relative; z-index: 1; width: auto; min-width: 240px; padding: clamp(11px, 2vmin, 15px) 40px; font-size: 15px; letter-spacing: 3px; margin-top: 2px;
  border-color: var(--gold); color: var(--gold-bright); box-shadow: inset 0 1px 0 rgba(255,220,150,.18), 0 0 22px rgba(201,162,74,.3), 0 2px 0 #000; }
.start-foot { position: relative; z-index: 1; margin-top: clamp(10px, 2.6vmin, 22px); font-family: var(--f-flavor); font-size: clamp(10px, 2vmin, 12px); color: var(--muted); letter-spacing: 1px; }

/* 縦持ちは #app を90°回転して横画面化するため、回転案内は不要 */
#rotate { display: none !important; }
#app { transform-origin: 0 0; }

/* ---------- responsive: 背の低い横画面・小画面 ---------- */
@media (max-height: 480px) {
  .hud-vitals { width: min(236px, 40vw); }
  .vital { margin-bottom: 4px; } .vbar { height: 13px; } .vlabel { font-size: 9px; width: 18px; }
  .vbar span { font-size: 9px; } .runinfo { font-size: 9px; margin-top: 3px; }
  .hud-btn { padding: 6px 9px; font-size: 10px; }
  #zoneinfo { font-size: 10px; }
  .title { font-size: clamp(28px, 6.4vw, 52px); letter-spacing: 3px; }
  .subtitle { font-size: 12px; margin: 8px auto 14px; }
  .card { padding: 11px; margin-bottom: 9px; } .card h3 { margin-bottom: 9px; }
  .town-body { padding: 10px; } .town-top { padding: 9px 12px; }
  .res-title { font-size: 30px; } .res-stats { margin: 12px 0; gap: 10px; }
  .cc-name { font-size: 19px; } .cc-blurb { min-height: 0; }
  .attr-row { padding: 6px 0; } .attr-val { font-size: 18px; }
}
@media (max-width: 620px) {
  .town-nav { gap: 2px; padding: 8px 8px 0; } .tnav { padding: 7px 11px 9px; font-size: 11.5px; }
  .res-stats > div { min-width: 74px; padding: 9px 12px; } .res-stats b { font-size: 20px; }
}
/* 職業・スキルは常に1行2枚（縦持ち回転でも崩れないよう幅メディアで段数を変えない） */
.class-grid, .skill-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
