/* はつめいロボバトルDX — base.css：色の変数・全体の枠・上のバー・3D 表示の枠・下のシートの枠（2026-12-02 P0 で css/style.css から同じ順番のまま分割。中身は変えていない。持ち主：P4） */
:root {
  --ink: #192038;
  --ink-soft: #475569;
  --panel-bg: rgba(255, 255, 255, 0.96);
  --accent-yellow: #ffd426;
  --accent-orange: #ff6b2b;
  --accent-blue: #228be6;
  --accent-cyan: #00b8d9;
  --accent-green: #20c96b;
  --accent-pink: #ff4988;
  --accent-purple: #7950f2;
  --vegas-bg: #120924;
  --vegas-card: rgba(24, 14, 52, 0.94);
  --vegas-gold: #ffd426;
  --vegas-magenta: #ff2e93;
  --vegas-cyan: #00f5d4;
  --tb: max(0px, calc(100% - 100svh));
  color-scheme: light;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

[hidden],
.hidden {
  display: none !important;
}

input,
textarea,
.code-textarea {
  -webkit-user-select: text;
  user-select: text;
}

button,
a,
select,
summary,
.tab-btn,
.icon-btn,
.tool-btn,
.action-pad-btn,
.dual-btn,
.part-card,
.chip-piece-btn,
.title-cta,
.title-sec-btn,
.class-card,
.cat-pill,
.slot-chip,
.vs-mode-btn,
.arena-pill,
.stage-btn,
.mini-preset-btn,
.prog-row-pill,
.prog-col-tab,
.base-sw-btn,
.prog-clear-row-btn,
.cta-battle-btn,
.subtab-btn,
.preset-item,
.color-swatch,
.dock-collapse-btn,
.replay-badge,
.stat-pill.clickable-pill,
.help-tab-btn,
.setting-btn,
.pause-btn {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  font-family: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', sans-serif;
  color: var(--ink);
  background: #dff5ff;
  -webkit-text-size-adjust: 100%;
}

#app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  position: relative;
}

/* iOS 26 bottom toolbar clearance in layout flex column without width-% bug */
#app::after {
  content: "";
  display: block;
  height: var(--tb);
  flex-shrink: 0;
  background: #ffffff;
}

svg.ico {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Slim Mobile-First Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: max(4px, env(safe-area-inset-top)) 8px 4px;
  background: #ffffff;
  border-bottom: 2.5px solid var(--ink);
  z-index: 20;
  flex-shrink: 0;
  min-height: 44px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-badge {
  background: var(--accent-orange);
  color: #fff;
  font-weight: 900;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  white-space: nowrap;
  letter-spacing: 0.03em;
}

.brand-title {
  font-weight: 900;
  font-size: 13.5px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-tabs {
  display: flex;
  gap: 4px;
  align-items: center;
}

.tab-btn {
  font-family: inherit;
  font-weight: 900;
  font-size: 11.5px;
  padding: 5px 9px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #f1f5f9;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  transition: transform 0.08s ease, background 0.12s ease;
  white-space: nowrap;
}

.tab-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.tab-btn.active {
  background: var(--accent-yellow);
}

.tab-btn.battle-tab.active {
  background: var(--accent-orange);
  color: #fff;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.icon-btn {
  font-family: inherit;
  font-weight: 800;
  font-size: 10.5px;
  padding: 4px 7px;
  border-radius: 9px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 28px;
}

.icon-btn:active {
  transform: translateY(2px);
  box-shadow: none;
}

.icon-btn.active-toggle {
  background: #d0ebff;
  color: #0b5394;
}

.icon-btn.kiddy-on {
  background: #fff3bf;
  color: #b45309;
}

button:focus-visible,
a:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

/* 3D Viewport Area */
#viewport-wrap {
  position: relative;
  flex: 1;
  min-height: 190px;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, #4db5ff 0%, #b8ecff 75%, #e6f9ff 100%);
}

#three-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  z-index: 1;
}

#speedlines-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

/* Collapsible Mobile-Friendly Bottom Sheet Dock */
#bottom-dock {
  background: #ffffff;
  border-top: 2.5px solid var(--ink);
  padding: 4px 8px max(7px, env(safe-area-inset-bottom));
  z-index: 20;
  flex-shrink: 0;
  position: relative;
  transition: max-height 0.2s ease;
}

#bottom-dock.collapsed .dock-panel {
  display: none !important;
}

.dock-handle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.dock-collapse-btn {
  font-family: inherit;
  font-size: 10px;
  font-weight: 900;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
}

.dock-panel {
  display: none;
}

.dock-panel.active {
  display: block;
}

/* Mobile Portrait Optimizations (No max-height: 450px landscape override — handled by orient.js) */
@media (max-width: 620px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 4px;
    padding: max(4px, env(safe-area-inset-top)) 6px 4px;
  }
  .brand-badge { display: none; }
  .brand-title { font-size: 12px; max-width: 96px; }
  .tab-btn { padding: 4px 7px; font-size: 10.5px; }
  .icon-btn {
    padding: 3px 6px;
    font-size: 10px;
    min-height: 28px;
  }
  .icon-btn span.lbl {
    display: inline;
    font-size: 9.5px;
  }
}
