:root { --bg: #060e20; --panel: #0c121d; --accent: #f59e0b; --text: #ffffff; --border: #2c3b5a; --active: #3b82f6; }
body { font-family: 'Helvetica Neue', Arial, sans-serif; background: #111; color: var(--text); display: flex; height: 100vh; margin: 0; overflow: hidden; }

/* 左サイドバー */
#left-sidebar { width: 170px; background: var(--panel); border-right: 1px solid #000; display: flex; flex-direction: column; padding: 10px; flex-shrink: 0; }
.btn-main { padding: 10px; background: var(--active); border: none; color: #fff; border-radius: 4px; cursor: pointer; font-weight: bold; margin-bottom: 8px; width: 100%; font-size: 12px; }
.guide-tab { padding: 8px; background: #151c2c; border: 1px solid var(--border); margin-bottom: 5px; cursor: pointer; font-size: 11px; display: flex; justify-content: space-between; align-items: center; border-radius: 4px; }
.guide-tab.active { border-color: var(--active); background: #1e293b; }

/* 中央エディタ */
#main-editor { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; align-items: center; background: #222; }
#canvas { background: var(--bg); width: 1080px; height: 1440px; display: flex; flex-direction: column; position: relative; padding: 10px 0 20px 0; box-sizing: border-box; flex-shrink: 0; overflow: hidden; }

/* ヘッダー（上部を圧縮） */
#header { height: 80px; display: flex; align-items: center; justify-content: space-between; padding: 0 60px; margin-bottom: 0px; }
#header-left { display: flex; align-items: center; gap: 20px; }
#header-icons { display: flex; gap: 10px; }
.header-slot { width: 85px; height: 85px; background: #000; border: 1px solid var(--border); position: relative; flex-shrink: 0; }
#difficulty-box { display: flex; gap: 8px; min-width: 110px; height: 35px; align-items: center; }
.diff-sq { width: 30px; height: 30px; border-radius: 3px; flex-shrink: 0; }
#title-container { border-bottom: 6px solid var(--accent); min-width: 450px; display: flex; justify-content: flex-end; }
#in-title { background: none; border: none; color: #fff; font-size: 48px; font-weight: 900; outline: none; text-align: right; width: 100%; }

/* 盤面エリア */
#board-area { width: 100%; height: 650px; background: #000; display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; margin-top: 5px; }
#board-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.black-section { background: #000; width: 100%; padding: 10px 60px; margin-bottom: 5px; box-sizing: border-box; }

/* 各行の設定 */
.row-wrap { padding: 0 60px; margin-top: 28px; display: flex; align-items: center; gap: 15px; width: 100%; box-sizing: border-box; }
.lv-label { width: 70px; text-align: center; flex-shrink: 0; }
.lv-val { background: none; border: none; color: #64748b; font-size: 20px; font-weight: 900; outline: none; text-align: center; width: 100%; }

/* スロット共通 */
.slot { background: #151c2c; border: 1px solid var(--border); position: relative; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: 4px; flex-shrink: 0; box-sizing: border-box; }
.slot.selected { border-color: var(--active); box-shadow: 0 0 15px var(--active); z-index: 50; }
.slot img { width: 100%; height: 100%; object-fit: cover; border-radius: 3px; pointer-events: none; }
.slot-group { display: flex; gap: 6px; align-items: flex-end; }

.size-L { width: 90px; height: 90px; }
.size-M { width: 65px; height: 65px; }
.size-S { width: 45px; height: 45px; }

.slot.aug-slot { border-radius: 50%; }
.slot.item-slot.size-L { border: 2px solid var(--accent) !important; }

/* GODスロット */
.god-wrap { position: relative; overflow: hidden; border-radius: 4px; display: flex; justify-content: center; align-items: center; background: #151c2c; border: 1px solid var(--border); flex-shrink: 0; }
.slot.god-slot { border: none !important; width: 100%; height: 100%; background: transparent; }
.god-name-label { position: absolute; top: 0; left: 0; width: 100%; font-size: 24px; font-weight: 400; color: #fff; text-align: center; background: transparent; text-shadow: 0 0 6px #000, 0 0 6px #000, 0 0 6px #000; pointer-events: none; z-index: 10; padding: 2px 0; word-break: break-all; }

.star-row { position: absolute; top: -22px; width: 100%; display: flex; justify-content: center; z-index: 100; left: 0; }
.star-row span { color: #fff; font-size: 24px; text-shadow: 0 2px 8px #000; line-height: 1; }

/* フッター（元のサイズに戻す） */
#footer { padding: 20px 60px; display: flex; flex-direction: column; gap: 15px; align-items: center; width: 100%; box-sizing: border-box; margin-top: auto; }
#f-bold { font-size: 40px; font-weight: 900; color: var(--accent); width: 100%; text-align: center; outline: none; line-height: 1.3; }
#f-desc { font-size: 28px; font-weight: 500; color: #eee; width: 100%; text-align: center; outline: none; white-space: pre-wrap; line-height: 1.5; }

/* 右サイドバー */
#right-sidebar { width: 340px; background: var(--panel); border-left: 1px solid #000; display: flex; flex-direction: column; padding: 12px; flex-shrink: 0; height: 100vh; }
.p-tab { flex: 1; padding: 10px 2px; font-size: 10px; background: #000; border: none; color: #666; cursor: pointer; font-weight: bold; }
.p-tab.active { color: #fff; border-bottom: 3px solid var(--accent); }
#palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 8px; }
.asset { cursor: pointer; border: 1px solid #222; overflow: hidden; display: flex; flex-direction: column; background: #111; }
.asset img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.asset span { font-size: 8px; color: #aaa; padding: 2px; text-align: center; }

.unified-size-ctrl { background: #222; padding: 10px; gap: 8px; display: flex; justify-content: center; flex-shrink: 0; border-top: 1px solid #333; }
.unified-size-ctrl button { flex: 1; padding: 8px; font-size: 11px; background: #334155; color: #fff; border: none; cursor: pointer; border-radius: 3px; font-weight: bold; }
.unified-size-ctrl button:active { background: var(--active); }

.symbol-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.symbol-btn { padding: 8px 10px; background: #334155; border: none; color: #fff; border-radius: 4px; cursor: pointer; font-size: 14px; min-width: 34px; }
.symbol-btn:hover { background: #3b4f6e; }
.symbol-text { color: #fff; font-size: 28px; font-weight: 900; }

.rem-btn { position: absolute; top: -5px; right: -5px; background: red; color: #fff; font-size: 10px; border: none; border-radius: 50%; width: 20px; height: 20px; display: none; z-index: 60; }
.slot:hover .rem-btn { display: flex; align-items: center; justify-content: center; }

#save-timer-display { font-size: 9px; color: #666; text-align: center; margin-bottom: 2px; }
#autosave-status { font-size: 10px; color: #22c55e; text-align: center; margin-bottom: 5px; opacity: 0; transition: opacity 0.5s; }
#autosave-status.show { opacity: 1; }

.url-tool-row { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.url-input-group { display: flex; gap: 4px; align-items: center; }
.url-btn { background: #334155; border: none; color: #fff; height: 28px; width: 32px; cursor: pointer; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }

/* Team builder styles */
.hex-board { display: inline-flex; flex-direction: column; gap: 28px; width: 100%; align-items: center; }
.hex-row { display: flex; gap: 28px; justify-content: center; }
.hex-row.offset { margin-left: 55px; }
.hex-slot { position: relative; width: 110px; height: 126px; cursor: pointer; }
.hex-inner { width: 100%; height: 100%; background: #111827; clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%); border: 2px solid #334155; transition: border-color 0.2s, box-shadow 0.2s; }
.hex-slot.selected .hex-inner { border-color: #f59e0b; box-shadow: 0 0 18px rgba(245, 158, 11, 0.35); }
.hex-stars { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; }
.hex-star { font-size: 16px; color: #f59e0b; text-shadow: 0 0 6px rgba(0, 0, 0, 0.6); }
.hex-items { position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; }
.hex-item-icon { width: 28px; height: 28px; object-fit: cover; border-radius: 6px; border: 1px solid #222; }
.champ-card, .item-card { background: #111827; border: 1px solid #334155; border-radius: 16px; padding: 8px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; transition: transform 0.2s, border-color 0.2s; }
.champ-card:hover, .item-card:hover { transform: translateY(-1px); border-color: #f59e0b; }
.champ-thumb, .item-thumb { width: 48px; height: 48px; border-radius: 12px; object-fit: cover; }
.champ-name { font-size: 11px; color: #e5e7eb; text-align: center; display: block; line-height: 1.2; }
.star-btn { border: 1px solid #334155; background: #0f172a; color: #f8fafc; padding: 10px; border-radius: 12px; cursor: pointer; transition: background 0.2s; }
.star-btn:hover { background: #1d2b47; }
/* タブレット以下（1024px以下） */
@media (max-width: 1024px) {
  .hex-row.offset {
    margin-left: 35px;     /* 57px → 少し小さく */
  }
}

/* スマホサイズ（768px以下） */
@media (max-width: 768px) {
  .hex-row.offset {
    margin-left: 22px;     /* さらに小さく（0pxだとズレがなくなって不自然） */
  }
}

/* さらに小さいスマホ（480px以下）で微調整したい場合は追加 */
@media (max-width: 480px) {
  .hex-row.offset {
    margin-left: 15px;     /* または16pxくらい */
  }
}

.team-builder #board-container {
  padding: 16px;
  overflow: hidden;
}
.team-builder #board-grid {
  width: fit-content;
  margin: 0 auto;
}
.team-builder .hex-slot {
  width: 90px;
  height: 104px;
}
.team-builder .hex-inner {
  transform: none;
  clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.team-builder .hex-inner .hex-symbol {
  font-size: 24px;
  color: #f8fafc;
  font-weight: bold;
}
.team-builder .hex-board { gap: 2px; align-items: flex-start; }
.team-builder .hex-row { display: flex; gap: 2px; }
.team-builder .hex-row.offset { margin-left: 46px; }
.team-builder .hex-slot { width: 90px; height: 104px; }
.team-builder .hex-inner { transform: none; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); }
.team-builder #builder-link { color: #f8fafc; }
.team-builder .btn-main { background: #f59e0b; color: #111; }
.team-builder .btn-main:hover { background: #fbbf24; }

.board-context-menu {
  position: absolute;
  background: #111827;
  border: 1px solid #334155;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0,0,0,.4);
  z-index: 1000;
  display: none;
  min-width: 180px;
}
.board-context-menu button {
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
}
.board-context-menu button:hover { background: #334155; }
