:root{
  --bg:#0f1220;
  --panel:rgba(0,0,0,.38);
  --panel2:rgba(0,0,0,.52);
  --line:rgba(255,255,255,.14);
  --text:#fff;
  --muted:rgba(255,255,255,.72);
  --good:#9fffa8;
  --warn:#ffd38a;
  --bad:#ff6b7a;
  --gold: rgba(255,210,124,.75);

  --shadow: 0 16px 45px rgba(0,0,0,.45);
  --radius:16px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,"Noto Sans JP",sans-serif;
  background: var(--bg);
  color: var(--text);
}

.roten-header{
  position:sticky;
  top:0;
  z-index:50;
  background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,0));
  backdrop-filter: blur(8px);
}
.roten-head-inner{ padding: 16px 14px 10px; }
.roten-title{ font-size: 22px; font-weight: 900; letter-spacing:.02em; }
.roten-sub{ margin-top:4px; color: var(--muted); font-size: 12px; }

.roten-app{
  padding: 10px 12px 26px;
  max-width: 980px;
  margin: 0 auto;
}

/* ===== Buttons ===== */
.btn{
  appearance:none;
  border:1px solid var(--line);
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 900;
  cursor:pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  line-height:1.1;
}
.btn:active{ transform: translateY(1px); }
.btn-ghost{ background: rgba(0,0,0,.18); }
.btn[disabled]{ opacity:.55; cursor:not-allowed; transform:none; }

.btn-gold{
  border-color: rgba(255,210,124,.40);
  background: linear-gradient(180deg, rgba(255,210,124,.22), rgba(0,0,0,.18));
  box-shadow: 0 0 0 2px rgba(255,210,124,.08) inset, 0 10px 24px rgba(0,0,0,.35);
}

/* ★デバッグボタン（オクト+1000）を“実験”っぽく */
#btnDebugPlus1000{
  border-color: rgba(255,107,122,.55);
  background: linear-gradient(180deg, rgba(255,107,122,.14), rgba(0,0,0,.18));
  box-shadow: 0 0 0 2px rgba(255,107,122,.10) inset;
}

/* ===== HUD ===== */
.hud{
  display:flex;
  gap:10px;
  align-items:flex-start;
  justify-content:space-between;
  padding: 12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
}
.hud-left{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  align-items:center;
  min-width: 0;
}
.hud-right{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
  align-items:center;
}
.hud-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border:1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: rgba(0,0,0,.18);
  font-size: 13px;
  white-space: nowrap;
}
.hud-pill--big .num{ font-size: 18px; font-weight: 900; }
.hud-pill .tag{ color: var(--muted); font-weight: 900; }
.hud-pill .ico{ opacity:.9; }
.hud-pill .sep{ opacity:.5; }
.hud-pill b{ font-weight: 900; }

/* ★スマホで「ごちゃごちゃ」を解消 */
@media (max-width: 560px){
  .hud{ flex-direction: column; }
  .hud-right{ width:100%; justify-content:flex-start; }
  .hud-right .btn{ flex: 1 1 calc(50% - 6px); }
  #btnOpenSell{ flex: 1 1 100%; }
  .hud-pill .lbl{ display:none; } /* ラベルを隠して横幅節約 */
}

/* ===== Tabs ===== */
.tabs{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top: 12px;
}
.tab{
  display:flex;
  align-items:center;
  justify-content:center;
  text-decoration:none;
  padding: 14px 12px;
  border:1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  background: rgba(0,0,0,.18);
  color: var(--text);
  font-weight: 900;
}
.tab.is-active{
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,210,124,.18) inset;
}

/* ===== Hero shopkeeper ===== */
.shop-hero{ margin-top: 12px; }
.hero-card{
  display:grid;
  gap:12px;
  padding: 12px;
  border:1px solid rgba(255,255,255,.10);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(0,0,0,.30), rgba(0,0,0,.15));
  box-shadow: var(--shadow);
}
@media (min-width:720px){
  .hero-card{ grid-template-columns: 260px 1fr; align-items:center; }
}
.hero-imgwrap{
  border-radius: var(--radius);
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.20);
  padding: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.hero-img{
  width: 180px;
  height:auto;
  image-rendering: pixelated;
  display:block;
  filter: drop-shadow(0 14px 14px rgba(0,0,0,.35));
}
.hero-dialog{ padding: 8px 8px 4px; }
.hero-name{ font-size: 16px; font-weight: 900; margin-bottom: 4px; }
.hero-text{
  font-size: 14px;
  line-height: 1.55;
  color: rgba(255,255,255,.92);
  padding: 10px 12px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.hero-actions{ display:flex; gap:10px; flex-wrap:wrap; margin-top: 10px; }
.hero-note{ margin-top: 8px; font-size: 12px; color: var(--muted); }

/* ===== Blocks ===== */
.block{
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: var(--shadow);
}
.block-head{ display:grid; gap:4px; margin-bottom: 10px; }
.block-title{ font-weight: 900; font-size: 16px; }
.block-sub{ color: var(--muted); font-size: 12px; }

/* ===== goods tabs ===== */
.goods-tabs{
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:8px;
  margin: 10px 0 12px;
}
.goods-tab{
  appearance:none;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 10px;
  font-weight: 900;
  cursor:pointer;
}
.goods-tab.is-active{
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(255,210,124,.18) inset;
}

/* ===== goods grid ===== */
.goods-grid{
  display:grid;
  grid-template-columns: repeat(2, 1fr);
  gap:10px;
}
@media (min-width:860px){
  .goods-grid{ grid-template-columns: repeat(3, 1fr); }
}
.good{
  border:1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(0,0,0,.18);
  overflow:hidden;
  display:grid;
}
.good-top{
  display:grid;
  grid-template-columns: 88px 1fr;
  gap:10px;
  padding: 10px;
  align-items:center;
}
.good-img{
  width: 88px;
  height: 88px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.good-img img{
  width: 78px;
  height:auto;
  image-rendering: pixelated;
  display:block;
}
.good-meta{ display:grid; gap:6px; }
.good-name{ font-weight: 900; line-height:1.2; }
.good-desc{ font-size: 12px; color: var(--muted); line-height: 1.35; }
.good-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding: 0 10px 10px;
}
.good-owned{ font-size: 12px; color: rgba(255,255,255,.88); }
.good-owned b{ font-size: 14px; }
.good-buy{ display:flex; gap:8px; align-items:center; }
.price{ font-size: 12px; color: var(--muted); }
.buybtn{ padding: 9px 10px; border-radius: 14px; }
.good.is-free{ opacity:.72; }
.good.is-free .buybtn{ opacity:.45; }

/* ===== Modal ===== */
.modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:1000;
}
.modal.is-open{ display:block; }
.modal__backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,.72);
}
.modal__sheet{
  position:absolute;
  left:50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(720px, 96vw);
  max-height: 86vh;
  overflow:hidden;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(20,28,40,.96), rgba(10,14,20,.96));
  box-shadow: var(--shadow);
}
.modal__grab{
  width: 46px;
  height: 5px;
  border-radius:999px;
  background: rgba(255,255,255,.22);
  margin: 10px auto 0;
}
.modal__head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.modal__title{ font-weight: 900; }
.modal__x{ padding: 8px 10px; }
.modal__body{
  padding: 12px;
  overflow:auto;
  max-height: calc(86vh - 54px);
}

/* ===== “ワクワク”購入演出 ===== */
.fx-card{
  position:relative;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(0,0,0,.18));
  padding: 12px;
  overflow:hidden;
}
.fx-card::before{
  content:"";
  position:absolute;
  inset:-40%;
  background: radial-gradient(circle at 30% 20%, rgba(255,210,124,.22), transparent 45%),
              radial-gradient(circle at 70% 60%, rgba(159,255,168,.14), transparent 45%),
              radial-gradient(circle at 40% 90%, rgba(120,190,255,.12), transparent 45%);
  transform: rotate(12deg);
  pointer-events:none;
}
.fx-title{
  position:relative;
  font-weight: 900;
  letter-spacing:.02em;
}
.fx-sub{ position:relative; color: var(--muted); font-size: 12px; margin-top: 4px; }

.fx-row{
  position:relative;
  display:grid;
  grid-template-columns: 96px 1fr;
  gap:12px;
  align-items:center;
  margin-top: 10px;
}
.fx-imgbox{
  width:96px;height:96px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
}
.fx-imgbox img{ width:84px;height:auto; image-rendering: pixelated; display:block; }
.fx-meta{ position:relative; display:grid; gap:6px; }
.fx-meta .name{ font-weight:900; }
.fx-meta .note{ color: var(--muted); font-size: 12px; line-height: 1.4; }

.fx-actions{
  position:relative;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  align-items:center;
  margin-top: 12px;
}
.fx-badge{
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.18);
  font-size: 12px;
  color: rgba(255,255,255,.9);
}
.fx-badge b{ font-size: 14px; }

/* ===== mikuji UI ===== */
.mikuji-wrap{ display:grid; gap:10px; }
.grill{ display:grid; grid-template-columns: repeat(3, 1fr); gap:10px; }
.ball{
  border:1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  background: rgba(0,0,0,.20);
  padding: 10px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  min-height: 82px;
}
.ball img{ width: 52px; height:auto; image-rendering: pixelated; display:block; }
.ball:active{ transform: translateY(1px); }
.reveal{
  border:1px solid rgba(255,255,255,.12);
  border-radius: 16px;
  background: rgba(0,0,0,.18);
  padding: 12px;
  display:grid;
  gap:10px;
  align-items:center;
  justify-items:center;
}
.reveal img{
  width: 110px;
  height:auto;
  image-rendering: pixelated;
  display:block;
  filter: drop-shadow(0 16px 16px rgba(0,0,0,.35));
}
.glow{ animation: glow 1.2s ease-in-out infinite; }
@keyframes glow{
  0%,100%{ filter: drop-shadow(0 12px 14px rgba(0,0,0,.40)); }
  50%{ filter: drop-shadow(0 16px 18px rgba(255,210,124,.22)); }
}
.note{ color: var(--muted); font-size: 12px; line-height: 1.4; }
.row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }
hr.sep{ border:0; border-top:1px solid rgba(255,255,255,.08); margin: 6px 0; }

/* =========================
   📱スマホ最適化（追記）
========================= */
@media (max-width: 520px){

  /* HUD：右側ボタンが詰まるので縦寄せ */
  .hud{
    flex-direction: column;
    align-items: stretch;
  }
  .hud-right{
    justify-content: flex-start;
  }
  .hud-right .btn{
    width: 100%;
    padding: 12px 12px;
  }

  /* 商品は1列でドーン（崩れ防止＋ワクワク） */
  .goods-grid{
    grid-template-columns: 1fr !important;
  }

  /* 商品カード内：画像を大きくする */
  .good-top{
    grid-template-columns: 110px 1fr;
  }
  .good-img{
    width: 110px;
    height: 110px;
  }
  .good-img img{
    width: 96px;
  }

  /* 文字が縦に割れるのを止める */
  .good-name,
  .good-desc{
    word-break: keep-all;
    overflow-wrap: anywhere;  /* 日本語はこれで自然 */
    line-break: strict;
  }
  .good-name{
    font-size: 16px;
    letter-spacing: .01em;
  }
  .good-desc{
    font-size: 13px;
  }

  /* 購入ボタンを押しやすく */
  .buybtn{
    padding: 12px 14px;
    border-radius: 16px;
  }

  /* タブを押しやすく */
  .goods-tab{
    padding: 14px 10px;
  }
}

/* =========================
   ✨ワクワク演出：購入モーダル
========================= */
.modal__sheet{
  animation: popIn .18s ease-out;
}
@keyframes popIn{
  from{ transform: translateX(-50%) translateY(14px) scale(.98); opacity:.6; }
  to  { transform: translateX(-50%) translateY(0) scale(1); opacity:1; }
}

/* タブを画面上に吸着（買い物が楽しい） */
.goods-tabs{
  position: sticky;
  top: 64px; /* ヘッダー分。必要なら調整 */
  z-index: 20;
  background: linear-gradient(180deg, rgba(15,18,32,.92), rgba(15,18,32,.35));
  backdrop-filter: blur(8px);
  padding: 8px 0;
  border-radius: 14px;
}

/* =========================
   📱 スマホ：店主ちょうど良いサイズ版
========================= */
@media (max-width: 560px){

  .hero-card{
    grid-template-columns: 1fr;
  }

  .hero-imgwrap{
    padding: 6px;
  }

  .hero-img{
    width: 72vw;        /* ← ★ここがポイント（自然サイズ） */
    max-height: 42vh;   /* ← 縦食いすぎ防止 */
    height: auto;

    image-rendering: auto;
  }
}

/* =========================
   ✅ Toast（購入完了ポップアップ）
   - CSSに潰されないよう !important 強め
========================= */
#toast{
  position: fixed !important;
  left: 12px !important;
  right: 12px !important;
  bottom: calc(14px + env(safe-area-inset-bottom)) !important;
  z-index: 2147483647 !important;
  pointer-events: none !important;

  opacity: 0 !important;
  transform: translateY(10px) scale(.98) !important;
  transition: opacity .16s ease, transform .18s ease !important;

  padding: 14px 14px !important;
  border-radius: 14px !important;
  font-weight: 900 !important;
  letter-spacing: .02em !important;
  text-align: center !important;

  color: #fff !important;
  background: rgba(15,18,32,.92) !important;
  border: 1px solid rgba(255,255,255,.16) !important;
  box-shadow: 0 18px 44px rgba(0,0,0,.55) !important;
  backdrop-filter: blur(6px) !important;
  -webkit-backdrop-filter: blur(6px) !important;
}

#toast.is-show{
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}
.roten-head-inner{
  display:flex;
  align-items:center;
  justify-content:center; /* 中央寄せ */
  position:relative;
  padding:16px 14px 10px;
}

.roten-back{
  position:absolute;
  left:14px; /* 左固定 */
}

.roten-head-center{
  text-align:center;
}
/* =========================
   購入タイトル 縦割れ完全防止 FIX
========================= */

.block-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

/* ← ここが超重要 */
.block-title{
  white-space: nowrap !important;   /* 絶対改行しない */
  word-break: keep-all !important;  /* 日本語1文字改行禁止 */
  overflow-wrap: normal !important; /* anywhere無効化 */
  flex: 1 1 auto;
  min-width: 0;
}

/* =========================
   🎨 ボタンカラー強化（世界観UP）
========================= */

/* 共通 */
.btn{
  border-radius:14px;
  font-weight:900;
  transition:.15s;
}

/* ---------- 通常（ネイビー） ---------- */
.btn{
  background: linear-gradient(180deg,#273155,#1a2036);
  border:1px solid rgba(255,255,255,.15);
  color:#fff;
}

.btn:active{
  transform:translateY(2px);
  filter:brightness(.9);
}


/* ---------- メイン（買うボタン専用） ---------- */
.buybtn{
  background: linear-gradient(180deg,#ffb347,#ff7a18);
  color:#2b1800;
  border:none;
  box-shadow:
    0 4px 0 #b85b12,
    0 10px 22px rgba(255,140,0,.35);
}

.buybtn:active{
  transform:translateY(3px);
  box-shadow:0 2px 0 #b85b12;
}


/* ---------- ゴールド（売却/重要） ---------- */
.btn-gold{
  background: linear-gradient(180deg,#ffe27a,#d4a900);
  color:#2a2000;
  border:none;
  box-shadow:
    0 4px 0 #9a7a00,
    0 10px 24px rgba(255,215,0,.35);
}


/* ---------- ゴースト（サブ） ---------- */
.btn-ghost{
  background: rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.18);
}


/* ---------- ホバー/タップ演出 ---------- */
.btn:hover{
  filter:brightness(1.08);
}
.buybtn{
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow{
  from{ box-shadow:0 4px 0 #b85b12, 0 0 10px rgba(255,140,0,.2);}
  to  { box-shadow:0 4px 0 #b85b12, 0 0 20px rgba(255,140,0,.6);}
}


