/* 深杜サーバー ダッシュボード
   配色は営業カレンダー（fukamori-gaming.com）のネオングリーンに合わせている。
   素材（ロゴ・アイコン）は /assets/ に置けば自動で表示される。無くても崩れない。 */

:root {
  /* ARK 版: 7DTD 版（緑ネオン）と区別するためシアン系にしている */
  --neon: #4dd4ff;
  --neon-dim: rgba(77, 212, 255, 0.35);
  --bg: #080b0f;
  --bg-panel: #101720;
  --bg-panel-2: #151f2b;
  --line: rgba(77, 212, 255, 0.18);
  --text: #e4eef7;
  --text-dim: #8ba0b5;
  --danger: #ff4d4d;
  --gold: #ffcf5c;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0,255,157,0.07), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--neon); }

/* --- ヘッダー --- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 12, 11, 0.85);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  max-width: 1180px; margin: 0 auto; padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand::before {
  /* 素材差し替え箇所: /assets/logo.png を置くと自動で表示される（無ければ何も出ない） */
  content: ""; width: 46px; height: 46px; flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-main {
  font-size: 1.25rem; font-weight: 700; letter-spacing: .12em;
  color: var(--neon); text-shadow: 0 0 14px var(--neon-dim);
}
.brand-sub { font-size: .62rem; letter-spacing: .28em; color: var(--text-dim); }

.status-pill {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: .8rem; background: var(--bg-panel);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-dim); }
.dot.online { background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.dot.offline { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* --- レイアウト --- */
.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

.stat-grid {
  display: grid; gap: 14px; margin-bottom: 20px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat-card {
  background: linear-gradient(180deg, var(--bg-panel-2), var(--bg-panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; text-align: center;
}
.stat-card.accent { border-color: rgba(0,255,157,.45); box-shadow: 0 0 24px rgba(0,255,157,.08) inset; }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-icon {
  width: 26px; height: 26px; margin: 0 auto 4px;
  background: var(--neon); opacity: .75;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-size: contain; mask-size: contain;
}
.stat-card.danger .stat-icon { background: var(--danger); }
.stat-label { font-size: .7rem; letter-spacing: .18em; color: var(--text-dim); }
.stat-value {
  font-size: 2.4rem; font-weight: 700; line-height: 1.15;
  color: var(--neon); text-shadow: 0 0 16px var(--neon-dim);
  font-variant-numeric: tabular-nums;
}
.stat-unit { font-size: .72rem; color: var(--text-dim); }

.bloodmoon {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid rgba(255,77,77,.5); background: rgba(255,77,77,.08);
  border-radius: var(--radius); padding: 12px 18px; margin-bottom: 20px;
  color: #ffd9d9; font-weight: 700;
}

.columns { display: grid; gap: 18px; grid-template-columns: 1.55fr 1fr; align-items: start; }
.side-column { display: grid; gap: 18px; }

.panel {
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-panel-2);
}
.panel-head h2 { margin: 0; font-size: .9rem; letter-spacing: .16em; color: var(--neon); }
.panel-actions { display: flex; align-items: center; gap: 6px; }

.btn {
  background: transparent; color: var(--text); cursor: pointer;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 3px 10px; font-size: .78rem; font-family: inherit;
}
.btn:hover { border-color: var(--neon); color: var(--neon); }
.zoom-label { font-size: .72rem; color: var(--text-dim); min-width: 22px; text-align: center; }

.toggle { display: flex; align-items: center; gap: 6px; font-size: .74rem; color: var(--text-dim); cursor: pointer; }

/* --- マップ --- */
.map-viewport {
  position: relative; height: 520px; overflow: hidden;
  background: #070908; cursor: grab; touch-action: none;
  /* ドラッグ中にタイルやラベルが範囲選択されるとパンが途切れる */
  user-select: none; -webkit-user-select: none;
}
.map-viewport.dragging { cursor: grabbing; }
.map-canvas { position: absolute; inset: 0; transform-origin: 0 0; }
.map-canvas img {
  position: absolute; image-rendering: pixelated;
  width: 128px; height: 128px;
}
.map-empty {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  color: var(--text-dim); text-align: center; pointer-events: none; padding: 20px;
}
.map-empty p { margin: 0; font-weight: 700; color: var(--text); }
.map-empty small { font-size: .78rem; }
.map-hint { margin: 0; padding: 8px 16px; font-size: .72rem; color: var(--text-dim); border-top: 1px solid var(--line); }

.map-marker {
  position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%; background: var(--neon); box-shadow: 0 0 12px var(--neon);
  border: 2px solid #04150e;
}
.map-marker-label {
  position: absolute; transform: translate(-50%, -180%);
  font-size: .68rem; white-space: nowrap; color: var(--neon);
  text-shadow: 0 0 6px #000, 0 0 6px #000;
}

/* --- プレイヤー一覧 --- */
.player-list { list-style: none; margin: 0; padding: 8px; min-height: 90px; }
.player-list li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
}
.player-list li + li { margin-top: 2px; }
/* 名前を押すと詳細が開くので、行そのものをボタンにしている */
.player-list .player-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 0; border: 0; background: transparent; color: inherit;
  font: inherit; text-align: left; cursor: pointer;
}
.player-list li:has(.player-row):hover { background: var(--bg-panel-2); }
.player-list .player-row:focus-visible { outline: 2px solid var(--neon); outline-offset: 3px; border-radius: 8px; }
.player-list .pname { font-weight: 700; }
.player-list .pmeta { margin-left: auto; font-size: .74rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.player-list .empty, .log-list .empty { color: var(--text-dim); justify-content: center; font-size: .8rem; }

/* --- ログ --- */
.log-panel .log-list {
  list-style: none; margin: 0; padding: 8px;
  max-height: 320px; overflow-y: auto; font-size: .84rem;
}
.log-icon { flex-shrink: 0; }
.log-list li { display: flex; gap: 9px; align-items: baseline; padding: 6px 8px; border-radius: 8px; }
.log-list li:nth-child(odd) { background: rgba(255,255,255,.02); }
.log-time { color: var(--text-dim); flex-shrink: 0; font-variant-numeric: tabular-nums; font-size: .76rem; }
.log-msg { word-break: break-word; }
.log-list li.warn .log-msg { color: var(--gold); }
.log-list li.error .log-msg { color: var(--danger); }

/* --- ランキング（準備中） --- */
.ranking-panel { margin-top: 18px; }
.coming-soon { padding: 34px 20px; text-align: center; color: var(--text-dim); }
.coming-soon p { margin: 0 0 4px; font-weight: 700; color: var(--text); }
.coming-soon small { font-size: .78rem; }

/* --- フッター --- */
.site-footer {
  border-top: 1px solid var(--line); padding: 18px 20px 40px;
  text-align: center; color: var(--text-dim); font-size: .78rem;
}
.site-footer p { margin: 2px 0; }

@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .map-viewport { height: 380px; }
  .stat-value { font-size: 2rem; }
}

/* --- 参加方法カード --- */
.join-panel { margin-bottom: 20px; }
.join-body { padding: 14px 16px; }
.join-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.join-key { font-size: .72rem; letter-spacing: .12em; color: var(--text-dim); min-width: 8.5em; }
.join-val {
  flex: 1 1 220px; user-select: all;
  background: #0a0f0d; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 11px; font-family: ui-monospace, Menlo, monospace;
  font-size: .92rem; color: var(--neon); word-break: break-all;
}
.btn.copy { flex-shrink: 0; }
.btn.copied { border-color: var(--neon); color: var(--neon); }
.join-note {
  margin: 12px 0 0; padding-left: 1.1em;
  font-size: .78rem; color: var(--text-dim); line-height: 1.8;
}
.join-note b { color: var(--text); }
.countdown { font-variant-numeric: tabular-nums; }

/* --- ランキング --- */
.rank-tabs { display: flex; gap: 6px; padding: 12px 16px 0; flex-wrap: wrap; }
.rank-tab.is-active { border-color: var(--neon); color: var(--neon); background: rgba(0,255,157,.08); }
.rank-list { list-style: none; margin: 0; padding: 12px 16px 4px; }
.rank-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: 10px;
}
.rank-list li + li { margin-top: 3px; }
.rank-list li:nth-child(-n+3) { background: rgba(255,255,255,.03); }
.rank-badge { width: 34px; height: 34px; flex-shrink: 0; background-size: contain;
  background-repeat: no-repeat; background-position: center; }
.rank-num {
  width: 34px; flex-shrink: 0; text-align: center;
  color: var(--text-dim); font-size: .82rem; font-variant-numeric: tabular-nums;
}
.rank-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score {
  margin-left: auto; flex-shrink: 0; color: var(--neon);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.rank-score small { color: var(--text-dim); font-weight: 400; margin-left: 3px; }
.rank-note { margin: 0; padding: 6px 16px 14px; font-size: .72rem; color: var(--text-dim); }

/* --- 推移グラフ --- */
.graph-panel { margin-top: 18px; }
.graph-body { position: relative; padding: 10px 12px 6px; }
#graph { width: 100%; height: 180px; display: block; }
.graph-empty {
  position: absolute; inset: 0; margin: 0; display: flex;
  align-items: center; justify-content: center;
  color: var(--text-dim); font-size: .8rem; pointer-events: none;
}
.legend { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; color: var(--text-dim); }
.legend .sw { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend .sw.players { background: var(--neon); }
.legend .sw.hostiles { background: var(--danger); }

/* --- プレイヤー詳細モーダル --- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: min(420px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--bg-panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 0 30px rgba(0, 255, 157, .12);
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg-panel);
}
.modal-head h3 { margin: 0; font-size: 1rem; color: var(--neon); }
.modal-close {
  margin-left: auto; background: transparent; border: 0; cursor: pointer;
  color: var(--text-dim); font-size: 1rem; line-height: 1; padding: 4px 6px;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 6px 14px 14px; }
.pm-sec { margin-top: 12px; }
.pm-sec h4 {
  margin: 0 0 6px; font-size: .72rem; letter-spacing: .08em;
  color: var(--text-dim); text-transform: uppercase;
}
.pm-sec dl { margin: 0; }
.pm-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 0; border-bottom: 1px dashed rgba(0, 255, 157, .10);
}
.pm-row dt { margin: 0; font-size: .82rem; color: var(--text-dim); }
.pm-row dd {
  margin: 0 0 0 auto; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pm-jump {
  margin-top: 10px; width: 100%; padding: 9px 10px;
  background: transparent; color: var(--neon);
  border: 1px solid var(--neon-dim); border-radius: 10px;
  font: inherit; font-size: .82rem; cursor: pointer;
}
.pm-jump:hover { background: rgba(0, 255, 157, .08); }
.pm-offline { margin: 12px 0 0; font-size: .78rem; color: var(--text-dim); }

/* ============================================================
   ARK ダッシュボード用の追加スタイル
   ============================================================ */

/* --- 接続情報（公開ページの目玉。視聴者がここを見て入る） --- */
.connect-box {
  background: linear-gradient(135deg, var(--bg-panel-2), var(--bg-panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.connect-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.connect-label {
  color: var(--text-dim);
  font-size: 0.85rem;
  min-width: 6.5em;
}
.connect-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.05rem;
  color: var(--neon);
  background: rgba(0, 0, 0, 0.3);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  word-break: break-all;
}
.copy-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.copy-btn:hover { color: var(--neon); border-color: var(--neon-dim); }
.copy-btn.copied { color: var(--neon); border-color: var(--neon); }
.connect-hint {
  color: var(--text-dim);
  font-size: 0.82rem;
  line-height: 1.7;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.connect-hint code {
  background: rgba(0, 0, 0, 0.35);
  padding: 2px 7px;
  border-radius: 5px;
  color: var(--neon);
  font-size: 0.85em;
}

/* --- MOD 一覧 --- */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.mod-item {
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.mod-name {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mod-id {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* --- プレイヤー一覧 --- */
.player-list { display: flex; flex-direction: column; gap: 8px; }
.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
.player-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neon); flex-shrink: 0;
  box-shadow: 0 0 8px var(--neon);
}
.empty-note {
  color: var(--text-dim);
  text-align: center;
  padding: 28px 12px;
  font-size: 0.9rem;
}

/* --- 管理ページ --- */
.admin-badge {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: 10px;
  vertical-align: middle;
  letter-spacing: 0.04em;
}
.gauge {
  height: 10px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--line);
}
.gauge-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--neon), #7de7ff);
  transition: width 0.4s ease;
}
.gauge-fill.warn { background: linear-gradient(90deg, var(--gold), #ffdf8a); }
.gauge-fill.danger { background: linear-gradient(90deg, var(--danger), #ff8080); }
.chart-wrap {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.chart-title {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
}
.chart-svg { width: 100%; height: 140px; display: block; }
.kv-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.kv-table th, .kv-table td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}
.kv-table th { color: var(--text-dim); font-weight: 500; width: 42%; }
.kv-table td { font-family: ui-monospace, monospace; }

/* マップ名など日本語が入るカードは、数値用の 2.4rem だと枠に収まらない */
.stat-value.is-text {
  font-size: 1.5rem;
  line-height: 1.3;
  word-break: keep-all;
}

/* hidden 属性より display 指定が強いと要素が消えない。
   .bloodmoon など display:flex を持つ要素で実際に起きたので明示する */
[hidden] { display: none !important; }
