@charset "UTF-8";
/*
  Google Fonts を外部読み込みせず、ローカル配布に切り替え。
  使い方:
    1) Google Fonts から DotGothic16 をダウンロード
    2) static/fonts/DotGothic16-Regular.woff2 を配置
*/
@font-face {
    font-family: "DotGothic16";
    src:
        url("fonts/DotGothic16-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}


:root {
    --bg-color: #1a1a24;
    --win-bg: #222233;
    --text-color: #f0f0f0;
    --accent-color: #f1c40f;
    --border-light: #606080;
    --border-dark: #0a0a10;
    
    /* マップ設定 (スマホ初期値) */
    --map-view-size: 350px;
    --cell-size: 50px;
    --center-offset-x: calc((var(--map-view-size) - var(--cell-size)) / 2);
    --center-offset-y: calc((var(--map-view-size) - var(--cell-size)) / 2);
    --center-offset: var(--center-offset-x);
    
    /* ゲージカラー */
    --hp-color: #e74c3c;
    --mp-color: #3498db;
    --exp-color: #2ecc71;
    --glass-bg: rgba(20, 20, 30, 0.85);
    
    /* ボタンカラー */
    --btn-gray: #555;
    --btn-blue: #3498db;
    --btn-green: #2ecc71;
    --btn-red: #e74c3c;
    --btn-orange: #e67e22;
    
    /* ツールチップ */
    --tooltip-border: #f1c40f;
    --tooltip-bg-top: #2c3e50;
    --tooltip-bg-bottom: #1a252f;
}

body {
    font-family: 'DotGothic16', sans-serif;
    text-align: center;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(0,0,0,0.4) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(0,0,0,0.4) 0%, transparent 20%),
        linear-gradient(rgba(0, 0, 0, 0.2) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.2) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 20px 20px, 20px 20px;
    color: var(--text-color);
    margin: 0; padding: 10px; box-sizing: border-box;
    overflow-x: hidden;
}

*, *::before, *::after { box-sizing: border-box; }
a { color: var(--accent-color); text-decoration: none; transition: 0.2s; }
a:hover { text-shadow: 0 0 8px var(--accent-color); color: #fff; }
h1, h2, h3 { margin-top: 0; border-bottom: 2px solid var(--border-light); padding-bottom: 10px; text-shadow: 2px 2px 0 #000; word-break: keep-all; }

/* --- コンテナ設定 --- */
.container, .battle-container, .shop-container, .menu-box {
    max-width: 800px; width: 100%; margin: 20px auto; padding: 20px;
    background-color: var(--win-bg); border: 2px solid var(--border-light);
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    border-radius: 8px; position: relative;
    overflow: visible;
}

/* --- 入力フォーム --- */
input, select, textarea {
    width: 100%; padding: 10px; margin: 5px 0; background: #111; color: white;
    border: 1px solid #555; border-radius: 4px; font-family: 'DotGothic16', sans-serif; font-size: 1rem;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-color); outline: none; }

/* --- テーブル --- */
.table-scroll { overflow-x: auto; margin-bottom: 15px; border: 1px solid #444; border-radius: 4px; }
table { width: 100%; border-collapse: collapse; min-width: 400px; } 
th, td { padding: 10px; border-bottom: 1px solid #444; text-align: left; }
th { background-color: #1a1a20; color: #aaa; }
tr:hover { background-color: rgba(255,255,255,0.05); }

/* --- ボタン --- */
button, .btn {
    display: inline-block; width: 100%; padding: 12px; margin: 5px 0; cursor: pointer; color: white; border: none;
    font-size: 1.1em; text-align: center; text-decoration: none; background-color: #444;
    border-radius: 4px;
    box-shadow: 0 4px 0 #222, inset 0 1px 0 rgba(255,255,255,0.2);
    transition: 0.1s; position: relative; font-family: 'DotGothic16', sans-serif;
}
button:active, .btn:active { transform: translateY(4px); box-shadow: 0 0 0 #222, inset 0 1px 0 rgba(255,255,255,0.2); }

.btn-primary, .btn-map, .btn-go { background-color: var(--btn-blue); border-bottom: 4px solid #21618c; }
.btn-success, .btn-add { background-color: var(--btn-green); border-bottom: 4px solid #1e8449; }
.btn-danger, .btn-remove, .btn-atk { background-color: var(--btn-red); border-bottom: 4px solid #922b21; }
.btn-inn { background-color: var(--btn-orange); border-bottom: 4px solid #a04000; }
.btn-tavern { background-color: #8e44ad; border-bottom: 4px solid #5b2c6f; }
.btn-shop { background-color: #27ae60; border-bottom: 4px solid #145a32; }
.btn-run { background-color: #7f8c8d; border-bottom: 4px solid #515a5a; }

.btn-go { width: 30%; border-radius: 0 5px 5px 0; margin: 5px 0; }
.btn-plus {
    background-color: var(--btn-blue); padding: 5px 10px; margin: 0; width: 30px; height: 30px; 
    line-height: 1; font-weight: bold; display: inline-flex; align-items: center; justify-content: center;
}

/* メニューボタン */
.btn-menu { width: 100%; margin: 0; background: #34495e; border-bottom: 4px solid #2c3e50; font-size: 0.95em; padding: 10px; }
.btn-menu.guild { background: #8e44ad; border-color: #71368a; }
.btn-menu.setting { background: #7f8c8d; border-color: #626567; }

/* --- ソート・フィルタ --- */
.sort-nav { display: flex; gap: 5px; margin-bottom: 10px; overflow-x: auto; padding-bottom: 5px; justify-content: center; flex-wrap: wrap; }
.sort-btn { padding: 5px 10px; border: 1px solid #555; background: #222; color: #aaa; text-decoration: none; border-radius: 4px; white-space: nowrap; font-size: 0.85em; cursor: pointer; display: inline-block; width: auto; margin: 0; box-shadow: none; }
.sort-btn.active { background: #e67e22; color: white; border-color: #f1c40f; font-weight: bold; }

.filter-tabs { display: flex; border-bottom: 2px solid #555; margin-bottom: 10px; overflow-x: auto; }
.filter-tab { padding: 8px 15px; text-decoration: none; color: #aaa; background: #222; border-radius: 5px 5px 0 0; margin-right: 2px; white-space: nowrap; }
.filter-tab.active { background: #444; color: #fff; font-weight: bold; border-bottom: 2px solid #f1c40f; margin-bottom: -2px; }

/* --- マップ画面 (リッチ版) --- */
.map-view-wrapper {
    position: relative;
    padding: 10px;
    background: #111;
    border-radius: 10px;
    box-shadow: inset 0 0 20px #000, 0 0 15px rgba(241, 196, 15, 0.2);
    border: 1px solid #444;
    display: inline-block;
    margin-bottom: 10px;
}

.map-view {
    position: relative;
    width: var(--map-view-size);
    height: var(--map-view-size);
    overflow: hidden;
    margin: 0 auto;
    border: 2px solid #000;
    border-radius: 4px;
    /* マップ外(背景) : 移動に追従させるため、JSでbackground-positionを更新する */
    background-color: #616161;
    background-repeat: repeat;
    background-size: var(--cell-size) var(--cell-size);
    image-rendering: pixelated;
    transition: width 0.3s, height 0.3s, background-position 0.16s cubic-bezier(0.25, 0.1, 0.25, 1), background-size 0.16s cubic-bezier(0.25, 0.1, 0.25, 1);
    will-change: background-position, background-size;
}

/* マップ外(背景) 画像モード */
.render-image .map-view {
    background-image: url('images/map_rock.png');
}

/* マップ外(背景) CSSモード */
/* マップ外(背景) CSSモード：タイル基準の岩パターン（background-position が効くように） */
.render-css .map-view{
    background-color:#5e5e5e;
    background-image:
        radial-gradient(circle at 28% 30%, rgba(255,255,255,.16) 0 18%, rgba(0,0,0,.28) 19% 42%, transparent 43%),
        radial-gradient(circle at 72% 62%, rgba(255,255,255,.12) 0 16%, rgba(0,0,0,.28) 17% 40%, transparent 41%),
        radial-gradient(circle at 62% 22%, rgba(255,255,255,.10) 0 12%, rgba(0,0,0,.24) 13% 28%, transparent 29%),
        radial-gradient(circle at 18% 72%, rgba(255,255,255,.08) 0 10%, rgba(0,0,0,.22) 11% 26%, transparent 27%),
        radial-gradient(circle at 48% 78%, rgba(0,0,0,.20) 0 8%, transparent 9%),
        linear-gradient(135deg, rgba(0,0,0,.14), rgba(255,255,255,.06));
}

.map-table { 
    position: absolute; 
    top: 0; left: 0;
    will-change: transform;
    transform: translate3d(0,0,0);
    transition: transform 0.16s cubic-bezier(0.25, 0.1, 0.25, 1);
}


.map-cell { 
    width: var(--cell-size); 
    height: var(--cell-size); 
    position: relative; 
    box-sizing: border-box; 
}
.map-cell::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; image-rendering: pixelated; z-index: 0; }

.char {
    position: absolute; 
    width: var(--cell-size); 
    height: var(--cell-size); 
    z-index: 10; 
    top: var(--center-offset-y); 
    left: var(--center-offset-x);
    background-size: cover; background-position: center;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.8));
    animation: charBreath 2s infinite ease-in-out;
}
@keyframes charBreath { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* HUD (座標・天候) */
.hud-top-left, .hud-top-right {
    position: absolute; top: 10px; z-index: 20;
    background: rgba(0, 0, 0, 0.7); color: #fff;
    padding: 4px 8px; border-radius: 4px; font-size: 0.85em;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
}
.hud-top-left { left: 10px; }
.hud-top-right { right: 10px; }

/* Map HUD slimmer (以前のスリム版に寄せる) */
.map-view .hud-top-left, .map-view .hud-top-right{
  padding: 3px 6px;
  font-size: 0.78em;
  border-radius: 6px;
  top: 8px;
  line-height: 1.35; /* 日本語(天候名)の上下切れ対策 */
}

/* Weather display: single-line & readable (no cut)
   - 長い天候名は marquee（自動スクロール）
   - hover で停止
*/
#weatherDisplay{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:nowrap;
  white-space:nowrap;
}
#weatherDisplay .weather-icon{ font-size:1.05em; line-height:1.2; }
#weatherDisplay #wName{
  display:inline-flex;
  align-items:center;
  max-width: min(24em, 52vw);
  min-width: 1.6em;
  overflow-x:hidden;
  overflow-y:visible;
  white-space:nowrap;
  vertical-align:middle;
  line-height: 1.35; /* 文字の上下切れ対策 */
  padding: 2px 3px;
}
#weatherDisplay #wName .wname-text{ display:inline-block; }
#weatherDisplay #wName.marquee .wname-text{
  padding-right: 2em;
  will-change: transform;
  animation: sf_wname_marquee 10s linear infinite;
}
#weatherDisplay #wName.marquee:hover .wname-text{ animation-play-state: paused; }

@keyframes sf_wname_marquee{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(calc(-100% - 2em)); }
}

@media (max-width: 600px){
  .map-view .hud-top-left, .map-view .hud-top-right{ padding:2px 5px; font-size:0.72em; line-height:1.35; }
  #weatherDisplay{ gap:4px; }
  #weatherDisplay #wName{ max-width: 9em; }
}


/* --------------------------------------------------
   天候エフェクト（軽量CSSアニメ）
   - pointer-events: none で操作に影響させない
   - prefers-reduced-motion では自動OFF
-------------------------------------------------- */
.weather-fx {
    position: absolute;
    inset: 0;
    z-index: 15; /* char(10)より上、HUD(20)より下 */
    pointer-events: none;
    opacity: 0;
}

.weather-fx[data-weather-fx="none"]{ display:none; }

/* toggle button */
.weather-fx-toggle{
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(0,0,0,0.45);
    color: #fff;
    cursor: pointer;
    font-size: 0.9em;
    line-height: 1.2;
}
.weather-fx-toggle:hover{ background: rgba(0,0,0,0.65); }
.weather-fx-toggle.is-off{ opacity: 0.55; filter: grayscale(1); }

/* OFF flag */
body.weatherfx-off .weather-fx{ display:none !important; }

/* base pseudo layers */
.weather-fx::before,
.weather-fx::after{
    content: "";
    position: absolute;
    inset: -20%;
    background-repeat: repeat;
    will-change: transform, opacity, background-position;
}

/* 雨 */
.weather-fx[data-weather-fx="rain"],
.weather-fx[data-weather-fx="heavy_rain"],
.weather-fx[data-weather-fx="storm"]{ opacity: 1; }

.weather-fx[data-weather-fx="rain"]::before,
.weather-fx[data-weather-fx="heavy_rain"]::before,
.weather-fx[data-weather-fx="storm"]::before{
    background-image:
      repeating-linear-gradient(115deg, rgba(255,255,255,0.0) 0 10px, rgba(255,255,255,0.10) 10px 12px, rgba(255,255,255,0.0) 12px 24px);
    background-size: 40px 40px;
    transform: translate3d(0,0,0);
    animation: sfRainMove 0.9s linear infinite;
}

.weather-fx[data-weather-fx="heavy_rain"]::before{
    background-image:
      repeating-linear-gradient(115deg, rgba(255,255,255,0.0) 0 7px, rgba(255,255,255,0.14) 7px 10px, rgba(255,255,255,0.0) 10px 18px);
    animation-duration: 0.65s;
}

.weather-fx[data-weather-fx="storm"]::before{
    background-image:
      repeating-linear-gradient(115deg, rgba(255,255,255,0.0) 0 7px, rgba(255,255,255,0.15) 7px 10px, rgba(255,255,255,0.0) 10px 18px);
    animation-duration: 0.60s;
}

/* 雷フラッシュ */
.weather-fx[data-weather-fx="storm"]::after{
    background: rgba(255,255,255,0.0);
    animation: sfLightning 4.2s infinite;
}

@keyframes sfRainMove{
    0%{ transform: translate3d(-10%, -10%, 0); }
    100%{ transform: translate3d(10%, 30%, 0); }
}

@keyframes sfLightning{
    0%, 82%, 100%{ opacity: 0; }
    84%{ opacity: 0.12; }
    86%{ opacity: 0; }
    88%{ opacity: 0.18; }
    90%{ opacity: 0; }
}

/* 雪 */
.weather-fx[data-weather-fx="snow"]{ opacity: 0.95; }
.weather-fx[data-weather-fx="snow"]::before{
    background-image: radial-gradient(circle, rgba(255,255,255,0.65) 0 1px, rgba(255,255,255,0.0) 2px);
    background-size: 16px 16px;
    animation: sfSnowMove 6s linear infinite;
    filter: blur(0.2px);
}
.weather-fx[data-weather-fx="snow"]::after{
    background-image: radial-gradient(circle, rgba(255,255,255,0.45) 0 1px, rgba(255,255,255,0.0) 2px);
    background-size: 22px 22px;
    animation: sfSnowMove2 9s linear infinite;
    opacity: 0.8;
}

@keyframes sfSnowMove{
    0%{ transform: translate3d(-6%, -10%, 0); }
    100%{ transform: translate3d(6%, 20%, 0); }
}
@keyframes sfSnowMove2{
    0%{ transform: translate3d(6%, -12%, 0); }
    100%{ transform: translate3d(-6%, 22%, 0); }
}

/* 霧 */
.weather-fx[data-weather-fx="fog"]{ opacity: 0.55; }
.weather-fx[data-weather-fx="fog"]::before{
    background: radial-gradient(circle at 30% 40%, rgba(255,255,255,0.18), rgba(255,255,255,0.02) 60%, rgba(255,255,255,0.0) 75%);
    animation: sfFog 10s ease-in-out infinite alternate;
}
.weather-fx[data-weather-fx="fog"]::after{
    background: radial-gradient(circle at 70% 60%, rgba(255,255,255,0.15), rgba(255,255,255,0.01) 60%, rgba(255,255,255,0.0) 75%);
    animation: sfFog 14s ease-in-out infinite alternate-reverse;
}
@keyframes sfFog{
    0%{ transform: translate3d(-6%, -2%, 0); }
    100%{ transform: translate3d(6%, 2%, 0); }
}

/* 曇 */
.weather-fx[data-weather-fx="cloud"]{ opacity: 0.25; }
.weather-fx[data-weather-fx="cloud"]::before{
    background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.0));
    animation: sfCloud 8s ease-in-out infinite alternate;
}
@keyframes sfCloud{
    0%{ transform: translate3d(0, -3%, 0); }
    100%{ transform: translate3d(0, 3%, 0); }
}

@media (prefers-reduced-motion: reduce){
    .weather-fx{ display:none !important; }
}


/* --- ステータスパネル (リッチ版) --- */
.status-panel {
    background: var(--glass-bg);
    border: 1px solid var(--border-light);
    padding: 15px; border-radius: 8px; margin-top: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    text-align: left;
}
.status-header {
    display: flex; justify-content: space-between; align-items: baseline;
    border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; margin-bottom: 10px;
}
.char-name { font-size: 1.2em; font-weight: bold; color: var(--accent-color); }
.char-job { font-size: 0.9em; color: #aaa; }

.status-bars { margin-bottom: 15px; }
.bar-row { display: flex; align-items: center; margin-bottom: 6px; font-size: 0.85em; }
.bar-label { width: 30px; font-weight: bold; color: #ccc; }
.bar-track {
    flex: 1; height: 16px; background: #111; border-radius: 8px;
    position: relative; overflow: hidden; border: 1px solid #333;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.bar-fill { height: 100%; border-radius: 8px; width: 0; transition: width 0.5s ease-out; }
.hp-fill { background: linear-gradient(to right, #c0392b, #e74c3c); box-shadow: 0 0 10px #e74c3c; }
.mp-fill { background: linear-gradient(to right, #2980b9, #3498db); box-shadow: 0 0 10px #3498db; }
.exp-fill { background: linear-gradient(to right, #27ae60, #2ecc71); }
.stamina-fill { background: linear-gradient(to right, #f39c12, #f1c40f); box-shadow: 0 0 10px rgba(241,196,15,0.35); }
.bar-text {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75em; color: #fff; text-shadow: 1px 1px 1px #000;
}

.status-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; font-size: 0.9em;
    background: rgba(0,0,0,0.2); padding: 10px; border-radius: 6px;
}
.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-item span { color: #888; font-size: 0.8em; margin-bottom: 2px; }
.stat-item b { font-size: 1.1em; color: #eee; }

/* --- コントローラー (D-pad) --- */
.controls-container {
    background: rgba(0,0,0,0.3); padding: 10px; border-radius: 50%;
    width: 160px; height: 160px; margin: 10px auto;
    display: flex; align-items: center; justify-content: center;
    border: 2px solid rgba(255,255,255,0.1);
}
.d-pad {
    display: grid !important; grid-template-columns: repeat(3, 40px); grid-template-rows: repeat(3, 40px);
    gap: 5px; touch-action: none;
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none; -webkit-user-drag: none;
}
.move-btn{ -webkit-user-select:none; user-select:none; -webkit-touch-callout:none; -webkit-user-drag:none; }
.move-btn {
    width: 40px !important; height: 40px !important; margin: 0 !important; padding: 0 !important;
    border-radius: 8px; background: #444; border: 2px solid #222;
    box-shadow: 0 4px 0 #111; color: #ccc; font-size: 1.2em; line-height: 36px;
}
.move-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #111; background: #f1c40f; color: #000; border-color: #d35400; }
.d-pad-center { background: #222; border-radius: 50%; box-shadow: inset 0 0 5px #000; }
.move-btn.up { grid-column: 2; grid-row: 1; border-radius: 8px 8px 0 0; }
.move-btn.left { grid-column: 1; grid-row: 2; border-radius: 8px 0 0 8px; }
.move-btn.right { grid-column: 3; grid-row: 2; border-radius: 0 8px 8px 0; }
.move-btn.down { grid-column: 2; grid-row: 3; border-radius: 0 0 8px 8px; }

/* --- メニューグリッド --- */
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.relative { position: relative; }
.notify-badge {
    position: absolute; top: -5px; right: -5px;
    background: #e74c3c; color: white; border-radius: 50%;
    width: 20px; height: 20px; font-size: 0.75em; line-height: 20px; text-align: center;
    border: 2px solid #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* --- タイルスタイル (CSSモード) --- */
.render-css .tile-P::before { background-color: #7cbd71; background-image: linear-gradient(45deg, #6fb064 25%, transparent 25%, transparent 75%, #6fb064 75%, #6fb064), linear-gradient(45deg, #6fb064 25%, transparent 25%, transparent 75%, #6fb064 75%, #6fb064) !important; background-size: 20px 20px; }
.render-css .tile-F::before { background-color: #2e7d32; background-image: radial-gradient(circle, #388e3c 40%, transparent 41%) !important; background-size: 15px 15px; }
.render-css .tile-M::before { background-color: #795548; background-image: linear-gradient(135deg, transparent 40%, #8d6e63 40%, #8d6e63 60%, transparent 60%) !important; background-size: 25px 25px; }
.render-css /* 岩山タイル（CSS）: 岩っぽい見た目 */
.render-css .tile-R::before{
    background-color:#5e5e5e !important;
    background-image:
        radial-gradient(circle at 30% 32%, rgba(255,255,255,.18) 0 18%, rgba(0,0,0,.30) 19% 45%, transparent 46%),
        radial-gradient(circle at 68% 60%, rgba(255,255,255,.12) 0 16%, rgba(0,0,0,.30) 17% 40%, transparent 41%),
        radial-gradient(circle at 58% 22%, rgba(255,255,255,.10) 0 12%, rgba(0,0,0,.26) 13% 30%, transparent 31%),
        radial-gradient(circle at 18% 74%, rgba(255,255,255,.08) 0 10%, rgba(0,0,0,.24) 11% 28%, transparent 29%),
        linear-gradient(135deg, rgba(0,0,0,.16), rgba(255,255,255,.06)) !important;
}
.render-css .tile-W::before, .render-css .tile-OUT::before { background-color: #2980b9; animation: sea-flow 3s infinite linear; }
.render-css .tile-D::before { background-color: #f39c12; background-image: radial-gradient(#d35400 15%, transparent 16%) !important; background-size: 8px 8px; }
.render-css .tile-S::before { background-color: #ecf0f1; background-image: linear-gradient(135deg, #bdc3c7 10%, transparent 10%) !important; background-size: 20px 20px; }
.render-css .tile-T::before { background-color: #d35400; border: 4px double #fff; box-sizing: border-box; }
.render-css .tile-C::before { background-color: #9b59b6; border: 4px ridge #f1c40f; box-sizing: border-box; }
.render-css .tile-X::before { background: repeating-conic-gradient(#222 0% 10%, #550055 10% 20%) !important; animation: portalPulse 3s infinite linear; }
.render-css .tile-G::before { background-color: #4a148c; border: 4px double #8e44ad; box-sizing: border-box; }
.render-css .dungeon-point::after {
    background-image: none !important; background-color: #4a148c; border: 4px double #8e44ad;
    box-sizing: border-box; border-radius: 5px; box-shadow: 0 0 5px rgba(0,0,0,0.5); content: "" !important;
}
.render-css .tile-fog::before { background-color: #ecf0f1 !important; opacity: 0.9; }

@keyframes sea-flow { 0% { background-position: 0 0; } 100% { background-position: 25px 0; } }
@keyframes portalPulse { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }

/* --- 画像モード --- */
.render-image .map-cell::before { background-color: #222; background-size: cover; }
.render-image .tile-P::before { background-image: url('images/map_plain.png') !important; }
.render-image .tile-F::before { background-image: url('images/map_forest.png') !important; }
.render-image .tile-M::before { background-image: url('images/map_mountain.png') !important; }
.render-image .tile-R::before { background-image: url('images/map_rock.png') !important; }
.render-image .tile-B::before { background-image: url('images/map_bridge.png') !important; }
.render-image /* 岩山タイル（CSS）: 岩っぽい見た目 */
.render-css .tile-R::before{
    background-color:#5e5e5e !important;
    background-image:
        radial-gradient(circle at 30% 32%, rgba(255,255,255,.18) 0 18%, rgba(0,0,0,.30) 19% 45%, transparent 46%),
        radial-gradient(circle at 68% 60%, rgba(255,255,255,.12) 0 16%, rgba(0,0,0,.30) 17% 40%, transparent 41%),
        radial-gradient(circle at 58% 22%, rgba(255,255,255,.10) 0 12%, rgba(0,0,0,.26) 13% 30%, transparent 31%),
        radial-gradient(circle at 18% 74%, rgba(255,255,255,.08) 0 10%, rgba(0,0,0,.24) 11% 28%, transparent 29%),
        linear-gradient(135deg, rgba(0,0,0,.16), rgba(255,255,255,.06)) !important;
}
.render-image .tile-T::before { background-image: url('images/map_town.png') !important; }
.render-image .tile-C::before { background-image: url('images/map_castle.png') !important; }
.render-image .tile-W::before, 
.render-image .tile-OUT::before { background-image: url('images/map_sea.png') !important; }
.render-image .tile-D::before { background-image: url('images/map_desert.png') !important; }
.render-image .tile-S::before { background-image: url('images/map_snow.png') !important; }
.render-image .tile-X::before { background-image: url('images/map_space.png') !important; }
.render-image .tile-G::before { background-image: url('images/map_dungeon.png') !important; }
.render-image .tile-fog::before { background-image: none !important; background-color: #ecf0f1 !important; opacity: 0.9; }

/* アイコン類 */
.gather-point::after { content: "✨"; position: absolute; top:0; left:0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 1.5em; text-shadow: 0 0 5px yellow; animation: twinkle 1.5s infinite alternate; z-index: 5; }
.npc-point::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-image: var(--npc-bg); background-size: cover; background-position: center; image-rendering: pixelated; z-index: 6; }
.raid-point::after { content: "👿"; position: absolute; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #e74c3c; font-size: 2em; text-shadow: 2px 2px 0 #000; z-index: 7; animation: pulse 1s infinite; }
.rare-point::after { content: "🦄"; position: absolute; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #e74c3c; font-size: 2em; text-shadow: 2px 2px 0 #fff; z-index: 8; animation: bounce 1s infinite; } 
.dungeon-point::after { content: ""; position: absolute; top:0; left:0; width: 100%; height: 100%; background-image: url('images/map_dungeon.png'); background-size: cover; z-index: 6; opacity: 0.8; }

@keyframes twinkle { 0% { opacity: 0.5; transform: scale(0.8); } 100% { opacity: 1; transform: scale(1.2); } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* 汎用: バッジ */
.badge {
    display: inline-block; background: #e67e22; color: white; padding: 3px 8px; border-radius: 10px; font-size: 0.9em; margin: 2px; vertical-align: middle; white-space: normal; word-break: break-word; cursor: pointer; position: relative; border: 1px solid rgba(255,255,255,0.3);
    user-select: none;
}

/* ツールチップのターゲット（装備名など）: 見やすいダーク系 */
.tooltip-target {
    display: inline-block; background: #161616; color: #fff; padding: 3px 8px; border-radius: 10px; font-size: 0.9em; margin: 2px; vertical-align: middle; white-space: normal; word-break: break-word; cursor: pointer; position: relative; border: 1px solid rgba(255,255,255,0.25);
    user-select: none;
}
.mini-badge{display:inline-block;background:#34495e;color:#fff;padding:2px 6px;border-radius:10px;font-size:11px;line-height:1;margin-left:6px;vertical-align:middle;}

.tooltip-container { display: inline-block; position: relative; cursor: pointer; user-select: none; }
.tooltip-box {
    display: none; position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%); width: 240px;
    background: linear-gradient(to bottom, var(--tooltip-bg-top), var(--tooltip-bg-bottom));
    border: 3px double var(--tooltip-border); border-radius: 8px;
    box-shadow: 0 0 0 2px #000, 0 0 10px var(--tooltip-border), 0 10px 20px rgba(0,0,0,0.8);
    z-index: 1000; font-family: 'DotGothic16', sans-serif; color: #fff; text-align: left; pointer-events: none;
    animation: tooltipPop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.tooltip-header { display: flex; align-items: center; background: linear-gradient(to right, rgba(241, 196, 15, 0.2), transparent); padding: 8px 10px; border-bottom: 2px solid var(--tooltip-border); font-weight: bold; font-size: 1.15em; border-radius: 6px 6px 0 0; text-shadow: 1px 1px 0 #000; }
.tooltip-header-icon { font-size: 1.3em; margin-right: 8px; filter: drop-shadow(0 0 3px var(--tooltip-border)); }
.tooltip-body { padding: 10px; font-size: 0.95em; line-height: 1.5; background: rgba(0, 0, 0, 0.3); border-radius: 0 0 6px 6px; color: #e0e0e0; }

.tooltip-container:hover .tooltip-box, .tooltip-container.active .tooltip-box,
.badge:hover::after, .badge.active::after { display: block; }
@keyframes tooltipPop {
    from { opacity: 0; transform: translateX(-50%) scale(0.8) translateY(10px); }
    to   { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

/* Mobile: center tooltip to avoid off-screen overflow */
@media (max-width: 600px){
    .tooltip-box{
        position: fixed;
        top: 50%;
        left: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(90vw, 320px);
        max-height: 70vh;
        overflow: auto;
        pointer-events: auto;
        animation: none;
    }
}

/* --- バトル画面 --- */
.battle-main { display: flex; gap: 15px; margin-bottom: 15px; align-items: stretch; justify-content: space-between; }
.battle-col { flex: 1; background: rgba(0, 0, 0, 0.4); border: 2px solid #555; border-radius: 5px; padding: 10px; min-width: 0; }

/* Battle: 操作ボタンが枠外にはみ出ないように（レスポンシブ） */
.page-battle #playerControls{ max-width: 100%; }
.page-battle .battle-action-row{
  margin-top:5px;
  display:flex;
  gap:5px;
  flex-wrap:wrap;
  justify-content:center;
  align-items:center;
  max-width:100%;
}
.page-battle .battle-action-row > *{
  min-width:0;
  max-width:100%;
}
.page-battle .battle-action-row select{
  flex: 1 1 220px;
  max-width: 280px;
}
.page-battle .battle-action-row .btn.btn-atk{
  flex: 1 1 160px;
}
.page-battle .battle-action-row #tameControls{
  flex: 1 1 100%;
  justify-content:center;
  flex-wrap:wrap;
}
@media (max-width: 600px){
  .page-battle .battle-action-row select{ flex-basis:160px; max-width:100%; }
  .page-battle .battle-action-row .btn.btn-atk{ flex-basis:140px; }
}
.col-header { border-bottom: 2px solid #555; padding-bottom: 5px; margin-bottom: 10px; font-weight: bold; color: #aaa; display: flex; align-items: center; justify-content: center; gap: 5px; font-size: 1.2em; }
.unit-box { position: relative; background: linear-gradient(to right, rgba(40,40,50,0.9), rgba(30,30,40,0.9)); border: 1px solid #444; border-left: 4px solid #555; padding: 8px; margin-bottom: 8px; border-radius: 4px; transition: 0.2s; text-align: left; box-shadow: 2px 2px 5px rgba(0,0,0,0.3); }
.unit-box.ready { border-color: #f1c40f; background: linear-gradient(to right, rgba(60,50,30,0.9), rgba(40,30,20,0.9)); transform: scale(1.02); box-shadow: 0 0 10px rgba(241, 196, 15, 0.4); z-index: 10; }
.unit-box.dead { filter: grayscale(100%); opacity: 0.6; border-left-color: #555; }
.meter-frame { background: #111; border: 1px solid #444; height: 10px; width: 100%; max-width: 120px; border-radius: 3px; display: inline-block; vertical-align: middle; position: relative; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 2px; transition: width 0.12s linear; position: relative; }
.meter-fill.no-trans{ transition: none !important; }

.meter-fill::after { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 50%; background: rgba(255,255,255,0.2); border-radius: 2px 2px 0 0; }
.hp-bar { background: linear-gradient(to bottom, #e74c3c, #c0392b); }
.mp-bar { background: linear-gradient(to bottom, #3498db, #2980b9); }
.wt-bar { background: linear-gradient(to bottom, #f1c40f, #d35400); }
.atb-full .wt-bar { background: linear-gradient(to bottom, #f39c12, #e67e22); box-shadow: 0 0 8px #f1c40f; }
.damage-popup { position: fixed; font-size: 1.5em; font-weight: bold; text-shadow: 2px 2px 0 #000; pointer-events: none; z-index: 9999; animation: popUp 1s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); }
.dmg-red { color: #ff5e5e; font-size: 2.2em; } .dmg-yellow { color: #f1c40f; font-size: 2.2em; } .dmg-green { color: #2ecc71; font-size: 1.8em; } .dmg-miss { color: #aaa; font-size: 1.5em; }
@keyframes popUp { 0% { opacity: 0; transform: translate(-50%, 0) scale(0.5); } 10% { opacity: 1; transform: translate(-50%, -30px) scale(1.3); } 100% { opacity: 0; transform: translate(-50%, -80px); } }
.log-area { max-height: 150px; overflow-y: auto; font-size: 0.85em; text-align: left; background: rgba(0,0,0,0.6); padding: 10px; border: 1px solid #444; border-radius: 5px; margin-bottom: 10px; }

/* Battle: 軽量モード（戦闘が重い端末向け） */
.page-battle .lite-btn { background: #555; }
.page-battle .lite-btn.active { background: #2ecc71; }
.page-battle.lite-mode *,
.page-battle.lite-mode *::before,
.page-battle.lite-mode *::after {
    animation: none !important;
    transition: none !important;
}
.page-battle.lite-mode .damage-popup { display: none !important; }
.page-battle.lite-mode .unit-box.ready { transform: none; box-shadow: none; }


/* --- チャットウィンドウ --- */
.chat-window { position: fixed; bottom: calc(12px + 42px + env(safe-area-inset-bottom)); right: 10px; width: 300px; height: 250px; background: rgba(0, 0, 0, 0.9); border: 2px solid #555; border-radius: 8px; display: flex; flex-direction: column; z-index: 1000; box-shadow: 0 0 10px rgba(0,0,0,0.8); transition: none; min-width: 200px; min-height: 150px; max-width: 90vw; max-height: 80vh; }
.chat-window.minimized { height: 40px !important; min-height: 0 !important; overflow: hidden; }
.chat-header { background: #333; padding: 10px 12px; border-bottom: 1px solid #555; display: flex; justify-content: space-between; align-items: center; cursor: pointer; position: relative; z-index: 1003; touch-action: manipulation; }
.chat-body { flex: 1; overflow-y: auto; padding: 5px; font-size: 0.85em; text-align: left; }
.chat-input-area { padding: 5px; border-top: 1px solid #555; display: flex; gap: 5px; }
.chat-msg { margin-bottom: 4px; word-break: break-all; } .chat-global { color: #fff; } .chat-party { color: #2ecc71; } .chat-guild { color: #5dade2; } .chat-system { color: #f1c40f; font-weight: bold; } .chat-time { color: #888; font-size: 0.8em; margin-right: 5px; }
.chat-resize-handle{
  position:absolute;
  left:50%;
  transform:translateX(-50%);
  top:4px;
  width:160px;
  height:14px;
  background:rgba(255,255,255,0.22);
  border:1px solid rgba(255,255,255,0.35);
  border-radius:999px;
  z-index:1005;
  cursor:ns-resize;
  touch-action:none;
}
.chat-resize-handle::after{
  content:'';
  position:absolute;
  left:50%; top:50%;
  width:46px; height:4px;
  transform:translate(-50%,-50%);
  border-radius:999px;
  background:rgba(0,0,0,0.35);
  box-shadow:0 0 0 1px rgba(255,255,255,0.25) inset;
}


/* --- カジノ / その他 --- */
@keyframes neon { 0% { box-shadow: 0 0 5px #f1c40f; } 50% { box-shadow: 0 0 20px #f1c40f, 0 0 40px #e67e22; } 100% { box-shadow: 0 0 5px #f1c40f; } }
.casino-header h1 { animation: neon 2s infinite; }
.reel.blur { filter: blur(2px); background-image: linear-gradient(to bottom, #ccc 0%, #fff 50%, #ccc 100%); background-size: 100% 20%; animation: scroll 0.1s infinite linear; }
@keyframes scroll { 0% { background-position: 0 0; } 100% { background-position: 0 100px; } }
.slot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; background: #000; padding: 10px; border: 2px solid #555; margin-bottom: 15px; }
.win-line { box-shadow: 0 0 15px #f1c40f inset !important; background: #ffffcc !important; color: #e74c3c !important; border-color: #f1c40f !important; }
.economy-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-weight: bold; text-shadow: 1px 1px 0 #000; }

/* アイテムカード */
.item-card.select-all .item-header{ grid-template-columns: 30px 1fr; }
.item-card.mat .mat-right{ display:flex; flex-direction:column; align-items:flex-end; gap:2px; }
.item-card.mat .mat-price{ font-size: .75em; color:#888; white-space: nowrap; }

/* 凡例 (Grid対応 + 確実に表示させる) */
.map-legend { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(60px, 1fr)); 
    gap: 8px; 
    justify-content: center; 
    margin: 10px 0; 
    font-size: 0.85em; 
    background: rgba(0,0,0,0.4); 
    padding: 8px; 
    border-radius: 5px; 
    border: 1px solid #444; 
}
.legend-item { display: flex; align-items: center; gap: 4px; }
.legend-icon { 
    width: 20px; height: 20px; 
    border: 1px solid #777; 
    display: inline-block; 
    position: relative; 
    overflow: hidden; 
}
.legend-icon::before { 
    content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    background-size: cover; image-rendering: pixelated; 
}

/* 画面幅によるマップサイズ変更 (PC対応) */
@media (min-width: 768px) {
    :root {
        --map-view-size: 550px; /* PCでは大きく */
    }
}

/* スマホ調整 */
@media (max-width: 480px) {
    :root {
        --map-view-size: 300px; /* スマホでは小さく */
    }
    .container { padding: 10px; width: 98%; margin: 10px auto; }
    h1, h2 { font-size: 1.4em; }
    .status-panel { grid-template-columns: 1fr 1fr !important; gap: 5px; } 
    /* マップの凡例(map-legend)が画面上で重ならないように余白を確保 */
    .map-view { margin-bottom: 10px; }
    table { min-width: auto; width: 100%; font-size: 0.85em; }
    th, td { padding: 5px 2px; }
    .btn-plus { width: 30px; height: 30px; padding: 0; line-height: 28px; font-size: 1.2em; }
    .battle-main { display: flex; flex-direction: row; gap: 5px; }
    .battle-col { padding: 5px; font-size: 0.9em; }
    .chat-window { width: 100% !important; max-width: 100% !important; left: 0; right: 0; bottom: 0; margin: 0; height: 30vh; border-radius: 0; border: none; border-top: 2px solid #555; }
    .map-legend { grid-template-columns: repeat(auto-fit, minmax(50px, 1fr)); }
}

/* Admin monster list usability */
.table-scroll { max-height: 70vh; overflow: auto; }
.table-scroll table thead th { position: sticky; top: 0; background: #1f1f1f; z-index: 3; }
.admin-toolbar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; padding:10px; border:1px solid #444; border-radius:6px; margin:12px 0; background:#161616; }
.admin-toolbar input[type="text"], .admin-toolbar select { padding:6px 8px; border:1px solid #444; border-radius:6px; background:#0f0f0f; color:#eee; }
.admin-toolbar .btn { padding:6px 10px; border-radius:6px; border:1px solid #555; background:#2a2a2a; color:#fff; cursor:pointer; }
.admin-toolbar .meta { font-size:12px; color:#bbb; }


/* --- Map responsive fixes (CSP patch follow-up) --- */
@media (max-width: 520px){
  .container{ padding-left: 8px; padding-right: 8px; }
  .map-view-wrapper{ width: 100%; max-width: 100%; }
  .map-view{ width: 100%; max-width: 100%; height: auto; aspect-ratio: 1 / 1; }
  .map-view{ margin-bottom: 10px; }
  .map-legend{ margin-top: 8px; }
  .zoom-controls{ bottom: 8px; left: 8px; }
  .zoom-btn{ width: 36px; height: 36px; font-size: 1.3em; }
}


/* mobile: show the resize handle as a "grab bar" at the very top of the chat window.
   This keeps the header tappable and also keeps the handle visible even when minimized. */
@media (max-width: 600px){
  .chat-header{
    padding-top: 18px; /* make room for the grab bar */
    padding-bottom: 12px;
    position: relative;
    z-index: 1004;
    pointer-events: auto;
    touch-action: manipulation;
  }
  .chat-resize-handle{
    display:block !important;
    position:absolute;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 160px !important;
    height: 10px !important;
    top: 6px !important; /* inside the top edge */
    background: rgba(255,255,255,0.28) !important;
    border-radius: 999px !important;
    border: 1px solid rgba(255,255,255,0.35) !important;
    z-index: 1005;
    cursor: ns-resize;
    pointer-events: auto;
    touch-action: none;
  }
  /* keep visible even when minimized (users often want to drag-open/resize) */
  .chat-window.minimized .chat-resize-handle{ display:block !important; }
}

/* Battle log rich numbers */
.log-area .battle-log-line { line-height: 1.8; } /* 行間を少し広げる */

.log-area .battle-log-line .log-num {
  display: inline-block;
  font-family: 'Verdana', 'Arial', sans-serif; /* 数字は見やすいフォントに */
  font-weight: 900;
  font-size: 1.3em;
  padding: 0 4px;
  margin: 0 2px;
  vertical-align: baseline;
  position: relative;
  z-index: 1;
}


/* Skill name: flashy badge */
.log-area .battle-log-line .log-skill{
  display:inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 999px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: 0 0 6px rgba(52,152,219,0.55), 0 0 2px rgba(0,0,0,0.7);
  border: 1px solid rgba(52,152,219,0.55);
  background: rgba(52,152,219,0.18);
}

/* Gold highlight (tame success etc.) */
.log-area .battle-log-line .log-gold{
  display:inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 1000;
  color: #ffe66d;
  text-shadow:
    0 0 6px rgba(255,230,109,0.65),
    0 0 12px rgba(241,196,15,0.45),
    0 0 2px rgba(0,0,0,0.85);
  border: 1px solid rgba(241,196,15,0.75);
  background: linear-gradient(180deg, rgba(241,196,15,0.22), rgba(0,0,0,0.12));
  box-shadow: 0 0 10px rgba(241,196,15,0.25);
}

/* 敵へのダメージ（味方の攻撃）: 黄色 + 黒/濃いオレンジ縁 */
.log-area .battle-log-line .log-dmg-ally {
  color: #ffeb3b;
  text-shadow: 
    -2px -2px 0 #b7791f,  
     2px -2px 0 #b7791f,
    -2px  2px 0 #b7791f,
     2px  2px 0 #b7791f,
     0 0 5px rgba(0,0,0,0.5);
}

/* 味方へのダメージ（敵の攻撃）: 赤色 + 黒/濃い赤縁 */
.log-area .battle-log-line .log-dmg-enemy {
  color: #ff3333;
  text-shadow: 
    -2px -2px 0 #5c0000,  
     2px -2px 0 #5c0000,
    -2px  2px 0 #5c0000,
     2px  2px 0 #5c0000,
     0 0 5px rgba(0,0,0,0.5);
}

/* 回復: 緑色 + 黒/濃い緑縁 */
.log-area .battle-log-line .log-heal {
  color: #00ff00;
  text-shadow: 
    -2px -2px 0 #004d00,  
     2px -2px 0 #004d00,
    -2px  2px 0 #004d00,
     2px  2px 0 #004d00,
     0 0 5px rgba(0,0,0,0.5);
}


/* ミス: 灰色 + 黒縁（ログ内） */
.log-area .battle-log-line .log-miss {
  color: #cfcfcf;
  text-shadow:
    -2px -2px 0 #111,
     2px -2px 0 #111,
    -2px  2px 0 #111,
     2px  2px 0 #111,
     0 0 5px rgba(0,0,0,0.45);
}

/* クリティカル演出（既存維持・微調整） */
.log-area .battle-log-line .log-crit {
  font-size: 1.5em;
  animation: logCritPop 0.4s ease-out both;
}
@keyframes logCritPop{
  0%   { transform: translateY(0) scale(1); filter: brightness(1); }
  25%  { transform: translateY(-7px) scale(1.28); filter: brightness(1.35); }
  55%  { transform: translateY(0) scale(1.12); filter: brightness(1.15); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce){
  .log-area .battle-log-line .log-crit{ animation:none; }
}

/* --- Mobile usability fixes (iPhone etc.) --- */
@media (max-width: 768px){
  /* Keep the resize handle visible on touch devices (users still want to resize). */
  .chat-resize-handle{ display:block !important; width:120px !important; height:10px !important; top:6px !important; opacity:0.95; }
  /* Chat window full-width on small screens */
  .chat-window{ left:10px; right:10px; width:auto; max-width:none; }
  /* Move resize handle slightly above header so it won't block taps */
  .chat-resize-handle{ top:-6px !important; }

  /* Improve tap responsiveness */
  .chat-header, .auto-btn{ touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
}

/* --- Global footer (copyright + version) --- */
body.has-global-footer{ padding-bottom: 42px; }
.global-footer{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: rgba(0,0,0,0.78);
  color: rgba(255,255,255,0.85);
  font-size: 12px;
  line-height: 18px;
  padding: 6px 10px;
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(4px);
}

.global-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  text-align:left;
}
.global-footer .gf-left{ white-space:nowrap; opacity:0.85; }
.global-footer .gf-mid{ flex:1; text-align:center; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.global-footer .gf-right{ white-space:nowrap; opacity:0.9; }

 /* --- Map notice bar (raid spawn/defeat/escape etc.) --- */
 .map-notice-bar{
   background: rgba(0,0,0,0.65);
   border: 1px solid rgba(241,196,15,0.65);
   padding: 6px 10px;
   border-radius: 6px;
   margin-bottom: 8px;
 }
 .map-notice-bar .notice-item{
   color: #f1c40f;
   font-weight: 700;
   font-size: 0.92em;
   line-height: 1.25em;
 }

.map-notice-bar .notice-controls{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-bottom:4px;
}
.map-notice-bar .notice-filter-btn{
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: .9;
}
.map-notice-bar .notice-filter-btn:hover{ opacity: 1; }
.map-notice-bar .notice-list{ display:flex; flex-direction:column; gap:4px; width:100%; }
.map-notice-bar .notice-item{
  position:relative;
  display:block;
  width:100%;
  min-width:0;
  padding:0 28px 0 0;
}
.map-notice-bar .notice-msg{
  display:block;
  width:100%;
  min-width:0;
  max-width:100%;
  line-height:1.45em;
  white-space:normal;
  word-break:break-word;
  overflow-wrap:break-word;
  writing-mode:horizontal-tb !important;
  text-orientation:mixed !important;
}
.map-notice-bar .notice-close{
  position:absolute;
  top:0;
  right:0;
  background:none;
  border:none;
  color:#fff;
  opacity:.7;
  cursor:pointer;
  font-size:14px;
  line-height:14px;
  padding:2px 4px;
}
.map-notice-bar .notice-close:hover{ opacity:1; }
.map-notice-bar .notice-item.kind-important .notice-msg{ color:#ffd46b; }
.map-notice-bar .notice-item.kind-warn .notice-msg{ color:#ffb74d; }
.map-notice-bar .notice-item.kind-danger .notice-msg{ color:#ff6b6b; }
 .map-notice-bar.notice-flash{ animation: mapNoticeFlash 0.6s ease-out both; }
 @keyframes mapNoticeFlash{
   0%{ transform: translateY(0) scale(1); filter: brightness(1); }
   30%{ transform: translateY(-1px) scale(1.02); filter: brightness(1.45); }
   100%{ transform: translateY(0) scale(1); filter: brightness(1); }
 }

/* 橋タイル */
.tile-B::before{
  background-color:#8d6e63;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0, rgba(255,255,255,.18) 6px, rgba(0,0,0,.08) 6px, rgba(0,0,0,.08) 12px);
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.25);
}

/* 闇市ポイント（夜だけ出る） */
.blackmarket-point{
  position:relative;
}
.blackmarket-point::after{
  content:"🌙";
  position:absolute;
  right:2px;
  top:1px;
  font-size:14px;
  z-index: 12;
  pointer-events:none;
  filter: drop-shadow(0 0 4px rgba(255,255,255,.6));
}



.world-clock{ font-size:12px; opacity:0.9; margin-left:6px; white-space:nowrap; }

/* battle unit image */
.unit-img{width:44px;height:44px;object-fit:contain;border-radius:10px;background:rgba(0,0,0,.18);flex:0 0 auto;}
.unit-head{display:flex;gap:8px;align-items:center;justify-content:space-between;}
.unit-head-left{display:flex;gap:8px;align-items:center;}


/* --- 採取場所（鉱山/草原） --- */
.map-cell.site-mine  { outline: 2px solid rgba(155, 89, 182, 0.95); outline-offset: -2px; }
.map-cell.site-grass { outline: 2px solid rgba(46, 204, 113, 0.95); outline-offset: -2px; }

/* 採取場所(草原)は背景も草っぽくして見分けやすくする（タイルが岩でも上書き） */
.render-css  .map-cell.site-grass::before{
  background-color:#7cbd71 !important;
  background-image:
    linear-gradient(45deg, #6fb064 25%, transparent 25%, transparent 75%, #6fb064 75%, #6fb064),
    linear-gradient(45deg, #6fb064 25%, transparent 25%, transparent 75%, #6fb064 75%, #6fb064) !important;
  background-size: 20px 20px !important;
}
.render-image .map-cell.site-grass::before{
  background-image: url('images/map_plain.png') !important;
}

/* 採取場所アイコン（spanで重ねる：タイル用 ::before と衝突しない） */
.map-cell .site-badge{
  position:absolute;
  top:2px; left:2px;
  width:16px; height:16px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  line-height:16px;
  border-radius:6px;
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(255,255,255,0.18);
  z-index:7;
  pointer-events:none;
  filter: drop-shadow(0 0 2px rgba(0,0,0,.8));
}
.map-cell .site-badge-mine  { background: rgba(155, 89, 182, 0.28); border-color: rgba(155, 89, 182, 0.65); }
.map-cell .site-badge-grass { background: rgba(46, 204, 113, 0.30); border-color: rgba(46, 204, 113, 0.70); }
.site-badge-wood{ background: rgba(34,139,34,0.85); }


/* --------------------------------------------------
   QoL: 固定アクションHUD + 採取場所ツールチップ
-------------------------------------------------- */
.action-hud{
  position: fixed;
  right: 12px;
  bottom: calc(12px + 42px + var(--sf-chat-offset, 0px) + env(safe-area-inset-bottom));
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  max-width: 320px;
  padding: 10px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}
.action-hud.is-empty{ display:none; }
.action-hud .btn, .action-hud button{
  width: 100%;
}

.site-tooltip{
  position: fixed;
  z-index: 10000;
  padding: 10px 12px;
  background: rgba(0,0,0,0.75);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  color: #fff;
  font-size: 12px;
  max-width: 260px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
.site-tooltip .st-title{
  font-weight: 700;
  margin-bottom: 6px;
}
.site-tooltip .st-line{
  margin-top: 2px;
  opacity: 0.95;
}



/* ---- QoL: ボタン連打防止スピナー ---- */
button.is-loading, .btn.is-loading {
  opacity: 0.75;
  cursor: wait;
  position: relative;
}
button.is-loading::after, .btn.is-loading::after {
  content: "";
  position: absolute;
  right: 12px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: rgba(255,255,255,0.95);
  border-radius: 50%;
  animation: sfspin 0.8s linear infinite;
}
@keyframes sfspin { from { transform: rotate(0deg); } to { transform: rotate(360deg);} }

/* ---- QoL: ログ色分け ---- */
.log-area .log-success { color: #3ee88a; }
.log-area .log-fail { color: #ff5b5b; }
.log-area .log-warn { color: #ffd24d; }

/* ---- エラー詳細ボックス ---- */
.sf-errorbox{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
.sf-errorbox-inner{
  width: min(760px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: rgba(20,20,20,0.98);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 12px;
  padding: 14px;
}
.sf-errorbox-title{
  font-weight: bold;
  margin-bottom: 8px;
}
#sfErrorBoxText{
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.35);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.10);
}
.sf-errorbox-actions{
  margin-top: 10px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.site-tooltip .tipErrBtn{ margin-top: 8px; text-align:right; }



/* ================================
   Admin: Drop bulk selection (readability)
   ================================ */
input[type=checkbox], input[type=radio] {
  width: auto;
  padding: 0;
  margin: 0 6px 0 0;
  box-shadow: none;
}

.sf-drop-bulk-list {
  max-height: 320px;
  overflow: auto;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #555;
  background: #111;
  border-radius: 8px;
  text-align: left;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
}

.sf-drop-bulk-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid #333;
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
}

.sf-drop-bulk-row:hover {
  background: rgba(241,196,15,0.08);
  border-color: rgba(241,196,15,0.35);
}

.sf-drop-bulk-row input[type=checkbox] {
  margin-right: 6px;
}

.sf-drop-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 8px;
  border: 1px solid #444;
  border-radius: 999px;
  background: #222;
  color: var(--accent-color);
  font-size: 0.9em;
}

.sf-drop-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sf-drop-rate-wrap{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 4px;
  color: #bbb;
  white-space: nowrap;
}

.sf-drop-rate{
  width: 64px;
  height: 28px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #161616;
  color: #fff;
}


/* === RARITY COLORS === */

/* 汎用レア度カラー（装備名などで利用） */
.eq-name{font-weight:700;}
.rarity-1{color:#e0e0e0;}
.rarity-2{color:#2ecc71;text-shadow:0 0 2px rgba(46,204,113,.55);}
.rarity-3{color:#3498db;text-shadow:0 0 2px rgba(52,152,219,.55);}
.rarity-4{color:#9b59b6;text-shadow:0 0 2px rgba(155,89,182,.55);}
.rarity-5{color:#f1c40f;text-shadow:0 0 4px rgba(241,196,15,.55);}
/* 6+ は拡張用（未使用ならそのまま） */
.rarity-6{color:#e67e22;text-shadow:0 0 3px rgba(230,126,34,.55);}
.rarity-7{color:#e74c3c;text-shadow:0 0 3px rgba(231,76,60,.55);}
.rarity-8{color:#ff6b6b;text-shadow:0 0 3px rgba(255,107,107,.55);}
.rarity-9{color:#ff4757;text-shadow:0 0 3px rgba(255,71,87,.55);}
.rarity-10{color:#ff3838;text-shadow:0 0 3px rgba(255,56,56,.55);}

/* ==================================================
   HOUSING (1.1.2.0)
   ================================================== */

.housing-app{
  display:block;
  margin-top: 12px;
}


.housing-left, .housing-right{min-width:0;}

.housing-grid-wrap{
  border: 1px solid #2b2b2b;
  border-radius: 14px;
  padding: 10px;
  background: rgba(0,0,0,.35);
  box-shadow: 0 0 10px rgba(0,0,0,.35);
}

.housing-grid{
  --cell: 38px;
  display:grid;
  gap: 3px;
  user-select: none;
  touch-action: manipulation;
  position: relative;
  border-radius: 12px;
  padding: 10px;
  background: #1a1a1a;
}

/* floor themes */
.housing-grid[data-floor="wood"]{ background: linear-gradient(135deg, rgba(120,85,55,.35), rgba(30,30,30,.9)); }
.housing-grid[data-floor="stone"]{ background: linear-gradient(135deg, rgba(120,120,120,.25), rgba(24,24,24,.92)); }
.housing-grid[data-floor="carpet"]{ background: linear-gradient(135deg, rgba(160,40,60,.22), rgba(24,24,24,.92)); }
.housing-grid[data-floor="grass"]{ background: linear-gradient(135deg, rgba(40,140,70,.22), rgba(24,24,24,.92)); }

.housing-cell{
  width: var(--cell);
  height: var(--cell);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  color: transparent;
  cursor: pointer;
}
.housing-cell:hover{ background: rgba(255,255,255,.06); }

.housing-obj{
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 22px;
  border-radius: 12px;
  background: rgba(0,0,0,.38);
  border: 1px solid rgba(255,255,255,.16);
  z-index: 2;
  cursor: pointer;
  overflow: hidden;
}
.housing-obj.wall{
  background: rgba(30,30,50,.42);
  border-color: rgba(160,180,255,.22);
}
.housing-obj.selected{
  outline: 2px solid rgba(255,215,0,.65);
  box-shadow: 0 0 12px rgba(255,215,0,.25);
}

.housing-hint{
  margin-top: 10px;
  color: #bbb;
  font-size: 12px;
}

.housing-empty{
  padding: 14px;
  color: #ddd;
  background: rgba(0,0,0,.25);
  border: 1px dashed rgba(255,255,255,.18);
  border-radius: 12px;
}

.housing-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom: 10px;
}
.housing-tab{
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.35);
  color: #fff;
  cursor: pointer;
}
.housing-tab.active{
  border-color: rgba(255,215,0,.45);
  box-shadow: 0 0 10px rgba(255,215,0,.18);
}

.housing-card{
  background: rgba(0,0,0,.34);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 10px;
}
.housing-card-title{
  display:flex;
  align-items:center;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 10px;
}

.housing-gold{
  font-weight: 700;
  color: #ffd24d;
  text-shadow: 0 0 6px rgba(255,210,77,.25);
}

.housing-list{
  display:flex;
  flex-direction: column;
  gap: 8px;
}

.housing-item{
  display:grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: 8px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: #fff;
  cursor: pointer;
}
.housing-item:hover{ background: rgba(255,255,255,.06); }
.housing-item.selected{ border-color: rgba(255,215,0,.45); }

.housing-item .icon{ font-size: 18px; }
.housing-item .name{ font-weight: 700; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }
.housing-item .meta{ color:#bbb; font-size: 11px; white-space: nowrap; }
.housing-item .qty{ font-weight: 700; color:#ddd; white-space: nowrap; }

.housing-selected{ margin-bottom: 10px; }
.housing-btnrow{ display:flex; gap:8px; flex-wrap:wrap; }

.housing-shoprow{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
}
.housing-shoprow .left{ display:flex; align-items:center; gap:8px; min-width:0; }
.housing-shoprow .icon{ font-size: 18px; }
.housing-shoprow .name{ font-weight:700; }
.housing-shoprow .meta{ color:#bbb; font-size: 11px; }

.housing-formrow{ display:flex; align-items:center; gap:10px; margin: 10px 0; }
.housing-formrow .lbl{ width: 44px; color:#ddd; font-weight: 700; }
.housing-formrow select{
  flex: 1;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #161616;
  color: #fff;
}
.housing-formrow input[type="checkbox"]{ transform: scale(1.2); }

.housing-visitlog .row{ padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.08); }

/* message box helpers */
.information-box.ok{ border-color: rgba(46,204,113,.55); background: rgba(46,204,113,.10); }
.information-box.ng{ border-color: rgba(231,76,60,.55); background: rgba(231,76,60,.10); }
.information-box.info{ border-color: rgba(52,152,219,.45); background: rgba(52,152,219,.08); }


/* =======================
   Housing UI v2
   ======================= */
.housing-header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 12px;
  border-radius: 14px;
  margin-bottom: 10px;
}
.housing-title{ font-weight: 800; font-size: 18px; }
.housing-header-right{ display:flex; gap:10px; align-items:center; }

.housing-layout{
  display:grid;
  grid-template-columns: 340px 1fr 340px;
  gap: 12px;
}
@media (max-width: 1100px){
  .housing-layout{ grid-template-columns: 1fr; }
}

.housing-panel{
  padding: 12px;
  border-radius: 14px;
}
.housing-panel h3{
  margin: 10px 0 8px;
  font-size: 14px;
  color:#fff;
}

.housing-row{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items:center;
}

.housing-theme-box{
  display:grid;
  grid-template-columns: 44px 1fr;
  gap: 8px;
  align-items:center;
  margin-bottom: 8px;
}
.housing-select{
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #161616;
  color: #fff;
}
.housing-public-row{
  display:flex;
  gap: 10px;
  align-items:center;
  margin: 8px 0 2px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
}

.housing-list-item{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  cursor: pointer;
}
.housing-list-item:hover{ background: rgba(255,255,255,.05); }
.housing-list-item.active{ border-color: rgba(255,215,0,.45); box-shadow: 0 0 10px rgba(255,215,0,.18); }
.housing-icon{ width: 28px; text-align:center; font-size: 18px; }
.housing-list-main{ min-width:0; }
.housing-name{ font-weight: 800; overflow:hidden; text-overflow: ellipsis; white-space: nowrap; }

.housing-visits{ display:flex; flex-direction: column; gap: 6px; }
.housing-visit-row{ padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.08); }

.housing-center{ min-width: 0; }
.housing-house{
  padding: 12px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
}
.housing-house:before{
  content:"";
  position:absolute;
  inset: 0;
  opacity: .9;
  pointer-events:none;
}
.housing-house-meta{ margin-bottom: 8px; color:#bbb; }

/* theme floors */
.theme-floor-wood:before{ background: repeating-linear-gradient(45deg, rgba(120,72,24,.55), rgba(120,72,24,.55) 10px, rgba(90,50,18,.55) 10px, rgba(90,50,18,.55) 20px); }
.theme-floor-stone:before{ background: repeating-linear-gradient(45deg, rgba(120,120,120,.35), rgba(120,120,120,.35) 10px, rgba(80,80,80,.35) 10px, rgba(80,80,80,.35) 20px); }
.theme-floor-carpet:before{ background: repeating-linear-gradient(45deg, rgba(140,30,30,.30), rgba(140,30,30,.30) 8px, rgba(90,20,20,.30) 8px, rgba(90,20,20,.30) 16px); }
.theme-floor-grass:before{ background: repeating-linear-gradient(45deg, rgba(30,120,50,.28), rgba(30,120,50,.28) 8px, rgba(20,80,40,.28) 8px, rgba(20,80,40,.28) 16px); }

/* wall themes - subtle overlay */
.theme-wall-plaster:after{ content:""; position:absolute; inset:0; background: radial-gradient(circle at 20% 10%, rgba(255,255,255,.10), transparent 40%), radial-gradient(circle at 80% 20%, rgba(255,255,255,.06), transparent 45%); opacity:.8; pointer-events:none; }
.theme-wall-brick:after{ content:""; position:absolute; inset:0; background: repeating-linear-gradient(0deg, rgba(120,60,60,.15), rgba(120,60,60,.15) 18px, rgba(0,0,0,0) 18px, rgba(0,0,0,0) 20px), repeating-linear-gradient(90deg, rgba(120,60,60,.10), rgba(120,60,60,.10) 40px, rgba(0,0,0,0) 40px, rgba(0,0,0,0) 42px); opacity:.7; pointer-events:none; }
.theme-wall-wood:after{ content:""; position:absolute; inset:0; background: repeating-linear-gradient(90deg, rgba(120,72,24,.22), rgba(120,72,24,.22) 12px, rgba(80,45,16,.22) 12px, rgba(80,45,16,.22) 24px); opacity:.5; pointer-events:none; }
.theme-wall-paper:after{ content:""; position:absolute; inset:0; background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0)); opacity:.8; pointer-events:none; }

.housing-grid{
  position: relative;
  display: grid;
  gap: 2px;
  z-index: 2;
}
.housing-cell{
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.18);
}
.housing-cell:hover{ background: rgba(255,255,255,.05); }

.housing-placement{
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.30);
  cursor: pointer;
  user-select: none;
}
.housing-placement.wall{
  background: rgba(20,20,20,.38);
  border-color: rgba(180,180,255,.18);
}
.housing-placement.selected{
  border-color: rgba(255,215,0,.55);
  box-shadow: 0 0 12px rgba(255,215,0,.22);
}
.housing-placement-icon{ font-size: 22px; filter: drop-shadow(0 0 6px rgba(0,0,0,.35)); }

.housing-shop-row{
  display:flex;
  gap: 10px;
  align-items:center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
}
.housing-price{ color:#ffd24d; font-weight: 800; white-space: nowrap; }
.housing-qty{
  width: 64px;
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #161616;
  color: #fff;
}

.housing-toast{
  position: fixed;
  right: 14px;
  bottom: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.65);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  z-index: 9999;
  pointer-events:none;
}
.housing-toast.show{ opacity: 1; transform: translateY(0); }
.housing-toast.ok{ border-color: rgba(46,204,113,.55); }
.housing-toast.ng{ border-color: rgba(231,76,60,.55); }


/* -------------------------------------------------------------
   Buff/Debuff badges (battle / status)
------------------------------------------------------------- */
.cond-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 10px;
  border-radius:999px;
  font-size:12px;
  line-height:1.4;
  border:1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.45);
  color:#fff;
  white-space:nowrap;
  user-select:none;
}
.cond-badge::before{
  content:'';
  width:8px;
  height:8px;
  border-radius:999px;
  background:rgba(255,255,255,.35);
  box-shadow:0 0 0 1px rgba(0,0,0,.35);
}

/* Positive buffs */
.cond-badge.cond-atk-up,
.cond-badge.cond-def-up,
.cond-badge.cond-mat-up,
.cond-badge.cond-mdf-up,
.cond-badge.cond-spd-up,
.cond-badge.cond-regen,
.cond-badge.cond-mp-regen{
  border-color: rgba(46,204,113,.45);
  background: rgba(46,204,113,.12);
}
.cond-badge.cond-atk-up::before,
.cond-badge.cond-def-up::before,
.cond-badge.cond-mat-up::before,
.cond-badge.cond-mdf-up::before,
.cond-badge.cond-spd-up::before,
.cond-badge.cond-regen::before,
.cond-badge.cond-mp-regen::before{
  background: rgba(46,204,113,.95);
  box-shadow: 0 0 10px rgba(46,204,113,.35);
}

/* Negative debuffs */
.cond-badge.cond-poison,
.cond-badge.cond-burn,
.cond-badge.cond-paralysis,
.cond-badge.cond-sleep,
.cond-badge.cond-stun,
.cond-badge.cond-freeze,
.cond-badge.cond-bleed,
.cond-badge.cond-blind,
.cond-badge.cond-silence,
.cond-badge.cond-confuse,
.cond-badge.cond-fear,
.cond-badge.cond-curse,
.cond-badge.cond-slow,
.cond-badge.cond-atk-down,
.cond-badge.cond-def-down,
.cond-badge.cond-mat-down,
.cond-badge.cond-mdf-down,
.cond-badge.cond-spd-down{
  border-color: rgba(231,76,60,.45);
  background: rgba(231,76,60,.12);
}
.cond-badge.cond-poison::before,
.cond-badge.cond-burn::before,
.cond-badge.cond-paralysis::before,
.cond-badge.cond-sleep::before,
.cond-badge.cond-stun::before,
.cond-badge.cond-freeze::before,
.cond-badge.cond-bleed::before,
.cond-badge.cond-blind::before,
.cond-badge.cond-silence::before,
.cond-badge.cond-confuse::before,
.cond-badge.cond-fear::before,
.cond-badge.cond-curse::before,
.cond-badge.cond-slow::before,
.cond-badge.cond-atk-down::before,
.cond-badge.cond-def-down::before,
.cond-badge.cond-mat-down::before,
.cond-badge.cond-mdf-down::before,
.cond-badge.cond-spd-down::before{
  background: rgba(231,76,60,.95);
  box-shadow: 0 0 10px rgba(231,76,60,.35);
}

/* Barrier / Null (defensive) */
.cond-badge.cond-barrier,
.cond-badge.cond-phys-null,
.cond-badge.cond-mag-null{
  border-color: rgba(52,152,219,.55);
  background: rgba(52,152,219,.12);
}
.cond-badge.cond-barrier::before,
.cond-badge.cond-phys-null::before,
.cond-badge.cond-mag-null::before{
  background: rgba(52,152,219,.95);
  box-shadow: 0 0 10px rgba(52,152,219,.35);
}


.housing-layout{
  display:grid;
  grid-template-columns: 320px minmax(520px, 1fr) 300px;
  gap: 16px;
  align-items:start;
}
@media (max-width: 1320px){
  .housing-layout{ grid-template-columns: 300px minmax(420px,1fr) 280px; }
}
@media (max-width: 1100px){
  .housing-layout{ grid-template-columns: 1fr; }
}
.housing-panel,
.housing-house,
.housing-header{
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(32,36,74,.90), rgba(18,21,46,.94));
  box-shadow: 0 14px 32px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.05);
}
.housing-panel{ position:relative; overflow:hidden; }
.housing-panel:before,
.housing-house:before,
.housing-header:before{
  content:"";
  position:absolute;
  inset:0;
  background: radial-gradient(circle at top left, rgba(255,255,255,.06), transparent 34%);
  pointer-events:none;
}
.housing-grid-shell{
  display:flex;
  flex-direction:column;
  gap: 6px;
  position:relative;
  z-index:2;
}
.housing-grid-area{
  display:flex;
  gap: 6px;
  align-items:flex-start;
}
.housing-axis{
  display:grid;
  gap: 2px;
}
.housing-axis-top{ margin-left: 34px; }
.housing-axis-left{ width: 28px; }
.housing-axis-cell{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width: 28px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  color:#cbd4ff;
  font-size:11px;
  font-weight:700;
}
.housing-grid-rich{
  padding: 8px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.12);
  background: linear-gradient(180deg, rgba(10,13,29,.55), rgba(7,8,18,.78));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03);
  overflow:auto;
}
.housing-grid-rich .housing-cell{
  position:relative;
  overflow:hidden;
  border-color: rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(255,255,255,.045), rgba(0,0,0,.18));
}
.housing-grid-rich .housing-cell:after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(135deg, rgba(255,255,255,.05), transparent 55%);
  pointer-events:none;
}
.housing-house-meta{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
}
.housing-grid-legend{
  display:flex;
  gap: 8px;
  flex-wrap:wrap;
  margin-top: 8px;
  color:#d7dcff;
}
.housing-grid-legend span{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
}
.housing-cost-stack{
  display:flex;
  flex-direction:column;
  gap: 8px;
  margin-top: 10px;
}
.housing-cost-card{
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(0,0,0,.18));
}
.housing-cost-card.is-disabled{ opacity:.55; }
.housing-cost-title{ font-weight:800; margin-bottom:4px; }
.housing-cost-gold{ color:#ffd24d; font-weight:800; margin-bottom:6px; }
.housing-cost-materials{ display:flex; flex-wrap:wrap; gap:6px; }
.housing-cost-chip{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:5px 9px;
  border-radius:999px;
  font-size:12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.20);
}
.housing-cost-chip.ok{ border-color: rgba(46,204,113,.45); color:#c8f5d9; }
.housing-cost-chip.ng{ border-color: rgba(231,76,60,.45); color:#ffd0ca; }
.housing-shop-row{
  justify-content: space-between;
  margin-bottom: 8px;
}
.housing-shop-row .housing-list-main{ flex: 1; }
.housing-center{ min-width:0; }

.housing-popular-box{
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  box-shadow:0 8px 24px rgba(0,0,0,.18);
}
.housing-placement-tip{
  position:absolute;
  z-index:40;
  min-width:180px;
  max-width:260px;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.14);
  background:rgba(10,14,36,.94);
  color:#f4f7ff;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
  pointer-events:none;
  line-height:1.5;
}
.housing-placement-tip-title{
  font-weight:700;
  margin-bottom:6px;
  color:#fff3c4;
}
.housing-placement-tip-body{
  font-size:12px;
  color:#dfe7ff;
  white-space:normal;
}

/* Housing axis/grid precision tune ver.6.1.4.0 */
.housing-grid-shell{
  --housing-cell: 40px;
  --housing-axis-gap: 8px;
  --housing-axis-width: 40px;
  overflow: hidden;
}
.housing-grid-area{
  gap: var(--housing-axis-gap) !important;
  overflow: hidden;
}
.housing-axis-top-wrap{
  margin-left: calc(var(--housing-axis-width) + var(--housing-axis-gap)) !important;
  overflow: hidden;
  max-width: calc(100% - (var(--housing-axis-width) + var(--housing-axis-gap)));
}
.housing-axis,
.housing-grid{
  gap: 0 !important;
}
.housing-axis-top,
.housing-axis-left{
  will-change: transform;
}
.housing-axis-top{
  margin-left: 0 !important;
  width: max-content;
  min-width: max-content;
}
.housing-axis-left{
  width: var(--housing-axis-width) !important;
  min-width: var(--housing-axis-width) !important;
  overflow: hidden;
}
.housing-grid-viewport{
  overflow: auto;
  max-width: 100%;
  max-height: 680px;
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  scrollbar-gutter: stable both-edges;
}
.housing-grid-rich{
  padding: 0 !important;
  overflow: visible;
  flex: none;
  border: none;
  background: transparent;
  box-shadow: none;
}
.housing-axis-cell,
.housing-cell,
.housing-placement,
.housing-grid,
.housing-axis{
  box-sizing: border-box;
}
.housing-axis-cell,
.housing-cell{
  width: var(--housing-cell);
  min-width: var(--housing-cell);
  height: var(--housing-cell);
  min-height: var(--housing-cell);
}
.housing-placement{
  cursor: pointer;
}


/* ダンジョン踏破評価 */
.dungeon-eval-card{
  margin-top:14px;
  padding:16px;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.14);
  background:linear-gradient(180deg, rgba(20,26,42,.96), rgba(10,14,24,.96));
  box-shadow:0 14px 34px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.06);
}
.dungeon-eval-card.rank-s{border-color:rgba(255,215,64,.55); box-shadow:0 0 0 1px rgba(255,215,64,.16),0 18px 42px rgba(0,0,0,.4),0 0 28px rgba(255,215,64,.16);}
.dungeon-eval-card.rank-a{border-color:rgba(120,230,255,.45);}
.dungeon-eval-card.rank-b{border-color:rgba(150,255,180,.30);}
.dungeon-eval-card.rank-c{border-color:rgba(255,190,120,.25);}
.dungeon-eval-card.rank-d{border-color:rgba(255,120,120,.22);}
.dungeon-eval-header{display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:12px; flex-wrap:wrap;}
.dungeon-eval-sub{font-size:11px; letter-spacing:.18em; color:#8ea1c9; opacity:.92;}
.dungeon-eval-title{font-size:22px; font-weight:800; color:#fff; text-shadow:0 2px 14px rgba(120,180,255,.18);}
.dungeon-eval-rank-wrap{display:flex; align-items:center; gap:8px;}
.dungeon-eval-rank{display:inline-flex; align-items:center; justify-content:center; width:74px; height:74px; border-radius:999px; font-size:36px; font-weight:900; color:#fff; background:radial-gradient(circle at 35% 30%, #ffe58a, #f4b000 68%, #8a5d00 100%); box-shadow:0 10px 24px rgba(255,189,0,.25), inset 0 1px 0 rgba(255,255,255,.5);}
.dungeon-eval-card.rank-a .dungeon-eval-rank{background:radial-gradient(circle at 35% 30%, #b7f2ff, #40c9ff 70%, #18518f 100%); box-shadow:0 10px 24px rgba(64,201,255,.24), inset 0 1px 0 rgba(255,255,255,.45);}
.dungeon-eval-card.rank-b .dungeon-eval-rank{background:radial-gradient(circle at 35% 30%, #d0ffd9, #5fd37e 70%, #1d6230 100%);}
.dungeon-eval-card.rank-c .dungeon-eval-rank{background:radial-gradient(circle at 35% 30%, #ffe2b6, #ff9f55 70%, #8d4413 100%);}
.dungeon-eval-card.rank-d .dungeon-eval-rank{background:radial-gradient(circle at 35% 30%, #ffc0c0, #ff6767 70%, #7c1f1f 100%);}
.dungeon-eval-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(160px,1fr)); gap:10px;}
.dungeon-eval-metric{padding:12px; border-radius:14px; background:rgba(255,255,255,.04); border:1px solid rgba(255,255,255,.08);}
.dungeon-eval-label{font-size:12px; color:#90a5c7; margin-bottom:6px;}
.dungeon-eval-value{font-size:20px; font-weight:800; color:#fff; margin-bottom:8px;}
.dungeon-eval-grade{display:inline-flex; align-items:center; justify-content:center; min-width:34px; padding:4px 10px; border-radius:999px; font-size:13px; font-weight:800; color:#fff;}
.dungeon-eval-grade.grade-s{background:linear-gradient(180deg,#ffd55a,#d49a00);}
.dungeon-eval-grade.grade-a{background:linear-gradient(180deg,#70deff,#289bff);}
.dungeon-eval-grade.grade-b{background:linear-gradient(180deg,#8ff7b0,#3fb36b);}
.dungeon-eval-grade.grade-c{background:linear-gradient(180deg,#ffc586,#f2852e);}
.dungeon-eval-grade.grade-d{background:linear-gradient(180deg,#ff9a9a,#ea4d4d);}
