/* ==========================================
   ДРІМОПОЛІЯ v3.2 — КРИТИЧНИЙ LAYOUT ТА 9x9 BOARD GRID
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Montserrat:wght@600;700;800;900&display=swap');

:root {
  --bg-app: #08111F;
  --surface-1: #0E192B;
  --surface-2: #122138;
  --surface-3: #172A46;
  --border-default: rgba(148, 163, 184, 0.20);
  
  --primary-amber: #F5A800;
  --primary-amber-hover: #FFB928;
  --success-green: #22C55E;
  --danger-red: #EF4444;
  --info-blue: #3B82F6;
  --purple-accent: #A855F7;
  
  --text-primary: #F4F7FB;
  --text-secondary: #A9B5C7;
  --text-muted: #708096;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-app);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
}

#app-root, .dreamopoly-app {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

h1, h2, h3, h4, .brand-title, .box-title, .panel-title, .mission-control-title {
  font-family: 'Montserrat', 'Inter', sans-serif;
}

/* ==================== 1. HEADER (Height: 60px) ==================== */
.app-header, .top-header {
  height: 60px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-nav-tabs {
  display: flex;
  gap: 16px;
  align-items: center;
}

.nav-tab {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.nav-tab.active {
  color: var(--primary-amber);
  border-bottom-color: var(--primary-amber);
  font-weight: 700;
}

.header-timer {
  color: var(--primary-amber);
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-2);
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
}

.mode-btn {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.mode-btn.active {
  background: var(--info-blue);
  color: #FFF;
  border-color: var(--info-blue);
}

/* ==================== 2. GRID TEMPLATE AREAS (DESKTOP LAYOUT) ==================== */
.main-game-layout,
.app-main-grid {
  display: grid !important;
  grid-template-columns: 250px minmax(0, 1fr) 300px !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  grid-template-areas:
    "left board right"
    "left actions right" !important;
  gap: 12px !important;
  padding: 12px 16px !important;
  height: calc(100vh - 60px) !important;
  width: 100vw !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

/* LeftSidebar */
.left-sidebar,
.col-left {
  grid-area: left !important;
  width: 250px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  height: 100% !important;
  overflow-y: auto !important;
}

/* GameBoard Container */
.center-column-board,
.col-center {
  grid-area: board !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

/* ActionPanel */
.action-panel-container,
.bottom-action-console,
.action-dock,
.action-console-panel {
  grid-area: actions !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin-top: 0 !important;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface-1) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 12px !important;
  padding: 10px 14px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6) !important;
  flex-shrink: 0;
  height: 140px !important;
}

/* RightSidebar */
.right-sidebar,
.col-right {
  grid-area: right !important;
  width: 300px !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  height: 100% !important;
  overflow-y: auto !important;
}

.panel-box, .panel-card, .sidebar-block {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 12px;
  box-sizing: border-box;
}

.box-title, .panel-title {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  margin-top: 0;
  margin-bottom: 8px;
  font-weight: 800;
}

/* ==================== 3. GAME BOARD 9x9 GRID ==================== */
.board-frame-wrapper, .board-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.board-32-grid, .board-grid-wrapper, .board-square-aspect {
  height: 100%;
  max-height: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  border: 1px solid var(--border-default) !important;
  background: var(--surface-1);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
  position: relative;
  box-sizing: border-box;
}

/* ПОЛНОЦІННА 11х11 СІТКА ДОШКИ (40 КЛІТИНОК) */
#board, .board {
  display: grid !important;
  grid-template-columns: repeat(11, 1fr) !important;
  grid-template-rows: repeat(11, 1fr) !important;
  gap: 2px !important;
  width: 100% !important;
  height: 100% !important;
  box-sizing: border-box !important;
  position: relative !important;
}

/* 40 ігрових карток-клітинок */
.tile, .board-tile, .game-card {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  box-sizing: border-box;
  border-radius: 4px;
  background: var(--surface-1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tile img, .board-tile img, .game-card img {
  max-width: 100% !important;
  max-height: 100% !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block;
}

/* ЦЕНТР ДОШКИ - MISSION CONTROL HUD (Комірки 2..10, 2..10) */
.mission-control-hud,
.center-hud,
.center-hud-dashboard {
  grid-column: 2 / 11 !important;
  grid-row: 2 / 11 !important;
  width: 100% !important;
  height: 100% !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  box-sizing: border-box;
  background: radial-gradient(circle at center, rgba(14, 25, 43, 0.98) 0%, rgba(8, 17, 31, 0.99) 100%);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  text-align: center;
  z-index: 2;
}

.mission-control-title {
  font-size: 13px;
  font-weight: 900;
  color: var(--primary-amber);
  letter-spacing: 0.05em;
  margin: 0;
  line-height: 1.3;
  text-transform: uppercase;
}

.mission-control-stages {
  list-style: none;
  padding: 0;
  margin: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-primary);
  font-weight: 700;
  text-align: left;
}

.mission-control-triad {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--text-secondary);
  width: 100%;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
}

.mc-triad-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mc-status-val {
  color: var(--text-primary);
}

.mc-status-val.text-muted-val {
  color: var(--text-secondary);
}

.mission-control-pipeline {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  padding: 6px 10px;
  border-radius: 6px;
  box-sizing: border-box;
}

.mc-pipeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  margin-bottom: 4px;
}

.mc-pipeline-label {
  font-weight: 800;
  color: var(--text-secondary);
}

.mc-pipeline-val {
  font-weight: 900;
  color: var(--info-blue);
}

.mc-progress-track {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.mc-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-amber), var(--info-blue));
  border-radius: 4px;
}

/* ==================== 4. ACTION PANEL ELEMENTS ==================== */
.turn-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-default);
}

.turn-number-badge {
  color: var(--primary-amber);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
}

.turn-stage-badge {
  color: var(--text-secondary);
}

.turn-stage-badge strong {
  color: var(--info-blue);
}

.dice-primary-action-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.dice-area-block {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 4px 10px;
}

.dice-pair-display {
  display: flex;
  gap: 6px;
  align-items: center;
}

.dice-cube-icon {
  font-size: 22px;
  line-height: 1;
  color: var(--primary-amber);
}

.dice-result-text {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
}

.dice-result-text strong {
  color: var(--primary-amber);
  font-size: 14px;
  font-weight: 800;
}

.primary-action-block {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.btn-primary-action,
#btn-roll-dice {
  width: 100%;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #F5A800 0%, #D97706 100%) !important;
  color: #0F172A !important;
  border: 1px solid #F5A800 !important;
  border-radius: 8px !important;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(245, 168, 0, 0.3) !important;
  transition: all 0.2s ease;
}

.btn-primary-action:hover:not(:disabled),
#btn-roll-dice:hover:not(:disabled) {
  background: linear-gradient(135deg, #FFB928 0%, #F5A800 100%) !important;
  box-shadow: 0 6px 18px rgba(245, 168, 0, 0.5) !important;
}

.secondary-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.btn-secondary-action {
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  transition: all 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-secondary-action:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--primary-amber);
}

.btn-secondary-action:disabled,
.btn-primary-action:disabled,
.btn-game:disabled,
.btn-action:disabled {
  background: var(--surface-2) !important;
  color: var(--text-muted) !important;
  border: 1px solid var(--border-default) !important;
  opacity: 0.65 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-lock-icon {
  font-size: 10px;
  opacity: 0.8;
}

/* ==================== 5. SIDEBAR CARDS & DETAILS ==================== */
.mentor-box, .mentor-block {
  border: 1px solid var(--border-default) !important;
  background: var(--surface-1) !important;
}

.mentor-avatar-frame {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 50%;
  overflow: hidden;
  border: 1.5px solid var(--border-default) !important;
  background: var(--surface-2);
  flex-shrink: 0;
}

.mentor-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 44px !important;
  max-height: 44px !important;
  object-fit: cover !important;
  object-position: top center !important;
  display: block;
}

.mentor-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mentor-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.mentor-role {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

.grbk-role-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--primary-amber);
  margin-bottom: 4px;
}

.grbk-role {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
}

.project-tag {
  font-size: 11px;
  color: var(--info-blue);
  font-weight: 600;
  margin-top: 4px;
}

.metric-line {
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  color: var(--text-secondary);
}

.text-cyan { color: var(--info-blue); }
.text-green { color: var(--success-green); }
.text-gold { color: var(--primary-amber); }
.text-purple { color: var(--purple-accent); }
.text-blue { color: var(--info-blue); }

.card-action-row {
  text-align: right;
  margin-top: 6px;
}

.btn-xs-link {
  background: transparent;
  border: none;
  color: var(--info-blue);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.btn-xs-link:hover {
  text-decoration: underline;
}

.log-entries {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  max-height: 100px;
}

.empty-portfolio-state {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 0;
}

.footer-brand-box {
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Custom Tooltip */
.custom-tooltip {
  position: absolute;
  background: var(--surface-1);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 11px;
  padding: 6px 10px;
  max-width: 240px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.custom-tooltip.show {
  opacity: 1;
}

@media (max-width: 900px) {
  .secondary-actions-grid {
    grid-template-columns: 1fr;
  }
}


/* ==========================================
   ТОЧКОВИЙ LAYOUT FIX — GRID-BOARD ТА BOARD WRAPPERS (ТЗ ITEMS 1-7)
   ========================================== */

/* 2. .board-frame-wrapper займає повну ширину центральної колонки */
.board-frame-wrapper, .board-viewport {
  width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 100% !important;
  max-height: 100% !important;
  box-sizing: border-box !important;
}

/* 3. #board-container заповнює 100% ширини з квадратним співвідношенням 1:1 */
#board-container,
.board-32-grid,
.board-grid-wrapper,
.board-square-aspect {
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  aspect-ratio: 1 / 1 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

/* 4. #board як wrapper для .grid-board */
#board, .board {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  display: block !important;
  box-sizing: border-box !important;
}

/* 1. ФАКТИЧНИЙ 11х11 GRID КОНТЕЙНЕР (.grid-board, .board-grid) */
.grid-board,
.board-grid {
  display: grid !important;
  grid-template-columns: repeat(11, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(11, minmax(0, 1fr)) !important;
  gap: 2px !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

/* 5 & 6. Розміри картки-клітинки строго в межах 1 grid-cell */
.board-tile-v2, .tile, .board-tile, .game-card {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  box-sizing: border-box !important;
  position: relative !important;
  overflow: hidden !important;
}

.tile-card-art-img, .tile img, .board-tile img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}

/* 7. Закріплення Mission Control у центральних комірках Row 2..10, Col 2..10 */
.dream-center-hub,
#center-hub-stage,
.mission-control-hud,
.center-hud,
.center-hud-dashboard {
  grid-column: 2 / 11 !important;
  grid-row: 2 / 11 !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  z-index: 2 !important;
  box-sizing: border-box !important;
}


/* ==========================================
   STRETCH CROSS-AXIS FIX FOR COL-CENTER & BOARD-FRAME-WRAPPER
   ========================================== */

.col-center,
.center-column-board,
.center-column {
  grid-area: board !important;
  width: 100% !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important; /* Розтягуємо покрокову ширину */
  justify-content: center !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
}

.board-frame-wrapper,
.board-viewport {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

#board-container,
.board-32-grid,
.board-grid-wrapper,
.board-square-aspect {
  height: 100% !important;
  max-height: 100% !important;
  max-width: 100% !important;
  aspect-ratio: 1 / 1 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}


/* ==========================================
   VISUAL POLISH — PHASE 1 (COMPACT GEOMETRY & TYPOGRAPHY)
   ========================================== */

/* 2. GameBoard Geometry — max-width 1080px, max-height 800px, centered */
#board-container,
.board-32-grid,
.board-grid-wrapper,
.board-square-aspect {
  width: 100% !important;
  max-width: 1080px !important;
  height: 100% !important;
  max-height: 800px !important;
  aspect-ratio: 1 / 1 !important;
  margin: 0 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  position: relative !important;
  box-sizing: border-box !important;
}

/* 3 & 4. Tile Geometry — vertical artwork max 85px x 115px */
.board-tile-v2, .tile, .board-tile, .game-card {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 2px !important;
  box-sizing: border-box !important;
}

.tile-card-art-wrap {
  width: 100% !important;
  height: 100% !important;
  max-width: 85px !important;
  max-height: 115px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  border-radius: 6px !important;
  overflow: hidden !important;
}

.tile-card-art-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 85px !important;
  max-height: 115px !important;
  object-fit: contain !important;
  display: block !important;
  border-radius: 6px !important;
}

/* 5 & 6. Mission Control Compact Layout (max-width 520px) */
.mission-control-hud,
.dream-center-hub,
#center-hub-stage {
  max-width: 520px !important;
  max-height: 580px !important;
  margin: 0 auto !important;
  padding: 16px 20px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  background: radial-gradient(circle at center, rgba(14, 25, 43, 0.98) 0%, rgba(8, 17, 31, 0.99) 100%) !important;
  border: 1px solid var(--border-default) !important;
  border-radius: 12px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
}

.mission-control-title {
  font-size: 13px !important;
  font-weight: 900 !important;
  color: var(--primary-amber) !important;
  line-height: 1.3 !important;
  text-align: center !important;
  margin: 0 0 10px 0 !important;
}

.mission-control-stages {
  font-size: 11px !important;
  gap: 4px !important;
  margin: 6px 0 12px 0 !important;
  padding: 0 10px !important;
  color: var(--text-primary) !important;
}

.mission-control-triad {
  background: var(--surface-2) !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-default) !important;
  gap: 4px !important;
  margin-bottom: 12px !important;
}

.mission-control-pipeline {
  background: var(--surface-2) !important;
  padding: 8px 12px !important;
  border-radius: 8px !important;
  border: 1px solid var(--border-default) !important;
}

/* 8. ActionPanel Height 125px & Max Width 1080px */
.action-panel-container,
.bottom-action-console,
.action-dock,
.action-console-panel {
  max-width: 1080px !important;
  margin: 0 auto !important;
  height: 125px !important;
  padding: 8px 14px !important;
  gap: 6px !important;
  box-sizing: border-box !important;
}

/* 9. Primary Action Button */
.btn-primary-action,
#btn-roll-dice {
  background: linear-gradient(135deg, #F5A800 0%, #D97706 100%) !important;
  color: #0F172A !important;
  font-weight: 900 !important;
  padding: 8px 18px !important;
  border-radius: 8px !important;
}

/* 11. Dice Area Styling */
.dice-area-block {
  padding: 4px 10px !important;
  border-radius: 8px !important;
  background: var(--surface-2) !important;
  border: 1px solid var(--border-default) !important;
}


/* ==========================================
   VISUAL POLISH — PHASE 1.1 (MICRO-POLISH)
   ========================================== */

/* Mission Control: 640px max width, seamless integration */
.mission-control-hud,
.dream-center-hub,
#center-hub-stage {
  max-width: 640px !important;
  max-height: 600px !important;
  margin: 0 auto !important;
  padding: 14px 22px !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: space-between !important;
  background: radial-gradient(circle at center, rgba(14, 25, 43, 0.98) 0%, rgba(8, 17, 31, 0.99) 100%) !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  border-radius: 10px !important;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.5) !important;
}

/* Збільшений макс. розмір артворків карток (92px x 125px) */
.tile-card-art-wrap {
  width: 100% !important;
  height: 100% !important;
  max-width: 92px !important;
  max-height: 125px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto !important;
  border-radius: 6px !important;
}

.tile-card-art-img {
  width: 100% !important;
  height: 100% !important;
  max-width: 92px !important;
  max-height: 125px !important;
  object-fit: contain !important;
  display: block !important;
  border-radius: 6px !important;
}

/* Вертикальне ущільнення LeftSidebar */
.left-sidebar,
.col-left {
  gap: 8px !important;
}

.left-sidebar .panel-box {
  padding: 10px 12px !important;
  border-radius: 10px !important;
}

.left-sidebar .box-title {
  margin-bottom: 6px !important;
}

/* ActionPanel dice + result компактна ліва група */
.dice-area-block {
  padding: 5px 12px !important;
  border-radius: 8px !important;
  background: var(--surface-2) !important;
  border: 1px solid var(--border-default) !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Висока читабельність неактивних кнопок */
.btn-secondary-action:disabled,
.btn-primary-action:disabled,
.btn-game:disabled,
.btn-action:disabled {
  background: rgba(18, 33, 56, 0.8) !important;
  color: #94A3B8 !important;
  border: 1px solid rgba(148, 163, 184, 0.15) !important;
  opacity: 0.7 !important;
  cursor: not-allowed !important;
}


/* ==========================================
   VISUAL POLISH — PHASE 2 (INFORMATION ARCHITECTURE)
   ========================================== */

/* LeftSidebar Guide & Progress */
.range-dot {
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 4px;
}

.amber-dot {
  color: var(--primary-amber) !important;
}

.legend-row.active-range {
  font-weight: 700;
  color: var(--text-primary);
}

/* RightSidebar Structured Cards */
.info-row {
  margin-bottom: 8px;
}

.info-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 2px;
}

.info-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.mentor-subtitle-tag {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}

.mentor-quote-bubble {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.3;
  background: var(--surface-2);
  padding: 8px;
  border-radius: 6px;
  border-left: 3px solid var(--info-blue);
}

.empty-portfolio-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
}

.empty-portfolio-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.timeline-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-entry.active-event {
  color: var(--text-primary);
  font-weight: 700;
}

.log-time-dot {
  font-size: 10px;
  color: var(--info-blue);
}


/* ==========================================
   VISUAL POLISH — PHASE 2.1 (FINAL CLEANUP & DESKTOP RESPONSIVENESS)
   ========================================== */

/* Header Responsiveness for 1366x768 */
@media (max-width: 1440px) {
  .app-header, .top-header {
    padding: 0 12px !important;
    gap: 8px !important;
  }

  .header-nav-tabs {
    gap: 8px !important;
  }

  .nav-tab {
    padding: 4px 6px !important;
    font-size: 11px !important;
  }

  .header-timer {
    padding: 4px 8px !important;
    font-size: 11px !important;
  }

  .mode-btn {
    padding: 4px 8px !important;
    font-size: 10px !important;
  }
}

/* Unified Action Links */
.card-action-row {
  text-align: right !important;
  margin-top: 8px !important;
  padding-top: 4px !important;
}

.btn-xs-link {
  background: transparent !important;
  border: none !important;
  color: var(--info-blue) !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  cursor: pointer !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  transition: color 0.15s ease !important;
}

.btn-xs-link:hover {
  color: var(--primary-amber) !important;
  text-decoration: underline !important;
}

/* Mission Control Triad Status Badges */
.mc-triad-badge {
  font-size: 10px !important;
  font-weight: 800 !important;
  padding: 2px 8px !important;
  border-radius: 4px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
}

.badge-neutral {
  background: var(--surface-3) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-default) !important;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.15) !important;
  color: var(--info-blue) !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
}

.badge-green {
  background: rgba(34, 197, 94, 0.15) !important;
  color: var(--success-green) !important;
  border: 1px solid rgba(34, 197, 94, 0.3) !important;
}

.badge-amber {
  background: rgba(245, 168, 0, 0.15) !important;
  color: var(--primary-amber) !important;
  border: 1px solid rgba(245, 168, 0, 0.3) !important;
}

/* ActionPanel on 1366x768 */
@media (max-width: 1440px) {
  .action-panel-container,
  .bottom-action-console {
    padding: 6px 10px !important;
    gap: 4px !important;
  }

  .btn-secondary-action {
    padding: 4px 6px !important;
    font-size: 10px !important;
  }

  .btn-primary-action,
  #btn-roll-dice {
    padding: 6px 12px !important;
    font-size: 12px !important;
  }
}


/* ==========================================
   PHASE 4 — CORE GAME FEEL VISUAL STYLES
   ========================================== */

/* Active Landed Tile Highlight */
.tile-active-landed {
  border: 2px solid var(--primary-amber) !important;
  box-shadow: 0 0 16px rgba(245, 168, 0, 0.6), inset 0 0 8px rgba(245, 168, 0, 0.3) !important;
  transform: scale(1.03) !important;
  z-index: 25 !important;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

/* Floating Resource Feedback Toasts */
.floating-feedback-toast {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, 0) scale(0.8);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 900;
  color: #FFFFFF;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--primary-amber);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 1000;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-feedback-toast.float-active {
  opacity: 1;
  transform: translate(-50%, -36px) scale(1.05);
}

.floating-feedback-toast.toast-exp {
  border-color: #3B82F6;
  color: #60A5FA;
}

.floating-feedback-toast.toast-trust {
  border-color: #10B981;
  color: #34D399;
}

.floating-feedback-toast.toast-budget {
  border-color: #F59E0B;
  color: #FBBF24;
}

/* Rolling Dice Bounce Effect */
.rolling {
  animation: diceRollBounce 0.15s infinite ease-in-out;
}

@keyframes diceRollBounce {
  0% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(15deg) scale(1.1); }
  100% { transform: rotate(-15deg) scale(0.95); }
}

/* Prefers Reduced Motion override */
@media (prefers-reduced-motion: reduce) {
  .rolling {
    animation: none !important;
  }
  .tile-active-landed {
    transform: none !important;
    transition: none !important;
  }
}


/* ==========================================
   PHASE 6 — DECISION UX & CONSEQUENCE FEEDBACK
   ========================================== */

/* Desktop Decision Modal Width (560px - 680px) */
@media (min-width: 1024px) {
  .decision-modal-card {
    max-width: 620px !important;
    width: 100% !important;
  }
}

/* Consequence Feedback Badges */
.consequence-feedback-panel {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  flex-wrap: wrap;
}

.consequence-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.consequence-badge.badge-plus {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(52, 211, 153, 0.4);
}

.consequence-badge.badge-minus {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.4);
}

/* Mission Control Subtle Update Animation */
.mission-control-updated {
  animation: missionControlPulse 1.2s ease-out 1;
}

@keyframes missionControlPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(59, 130, 246, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .consequence-badge,
  .mission-control-updated,
  .floating-feedback-toast {
    animation: none !important;
    transition: none !important;
  }
}

/* Ensure non-active modal overlays never intercept pointer events */
.game-modal-overlay:not(.show) {
  display: none !important;
  pointer-events: none !important;
}

.game-modal-overlay.show {
  display: flex !important;
  pointer-events: auto !important;
}


/* ==========================================
   PHASE 7 — UNIFIED EVENT & MODAL SYSTEM
   ========================================== */

/* 1. Base Overlay Visibility Model */
.game-modal-overlay:not(.show) {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

.game-modal-overlay.show {
  display: flex !important;
  pointer-events: auto !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 1000 !important;
}

/* 2. Unified Z-Index Scale */
.floating-feedback-toast {
  pointer-events: none !important;
  z-index: 100 !important;
}

.game-modal-card,
.decision-modal-card,
.mir-modal-card,
.victory-modal-card,
.v32-modal-container,
.trap-modal-card,
.spp-summary-card {
  z-index: 1010 !important;
}

/* 3. Common Modal Component Classes */
.game-modal-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.game-modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 10px 0;
}

.game-modal-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* 4. Mobile Standards (<768px) */
@media (max-width: 767px) {
  .game-modal-card,
  .decision-modal-card,
  .mir-modal-card,
  .victory-modal-card,
  .v32-modal-container,
  .trap-modal-card,
  .spp-summary-card {
    width: calc(100vw - 16px) !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .game-modal-actions,
  .modal-actions-bar,
  .mir-actions-bar,
  .trap-actions-bar {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
  }
}


/* ==========================================
   PHASE 8 — GAME STATE HUD & LIVE METRICS
   ========================================== */

.live-hud-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

.hud-top-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.hud-stage-dot {
  color: #38bdf8;
  margin-right: 4px;
}

.hud-progress-container {
  width: 100%;
  height: 5px;
  background: rgba(148, 163, 184, 0.2);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.hud-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.hud-bottom-subrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.hud-metric-pill, .hud-triad-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(30, 41, 59, 0.6);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.15);
}


/* Phase 8.1.1 Custom Mini HUD Icons Micro Polish */
.hud-mini-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  vertical-align: middle;
  flex: 0 0 auto;
  display: inline-block;
  margin-right: 3px;
}

.hud-triad-pill .hud-mini-icon {
  width: 20px;
  height: 20px;
}


/* ==========================================
   PHASE 8.0.2 — RESPONSIVE ACTIONPANEL VISIBILITY FIX
   ========================================== */

/* Desktop ActionPanel & Board Height Constraints (>= 768px) */
@media (min-width: 768px) {
  .col-center {
    max-height: calc(100dvh - 72px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 4px !important;
  }

  .board-frame-wrapper {
    max-height: calc(100dvh - 310px) !important;
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .live-hud-bar {
    flex: 0 0 auto !important;
    padding: 4px 10px !important;
    gap: 3px !important;
    margin-bottom: 4px !important;
  }

  .hud-top-subrow {
    font-size: 12px !important;
  }

  .hud-progress-container {
    height: 4px !important;
    margin: 2px 0 !important;
  }

  .hud-bottom-subrow {
    font-size: 11px !important;
  }

  .hud-metric-pill, .hud-triad-pill {
    padding: 2px 6px !important;
  }

  .action-panel-container {
    grid-area: auto !important;
    padding: 6px 10px !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
  }

  .dice-primary-action-row {
    gap: 8px !important;
  }

  .btn-primary-action,
  #btn-roll-dice {
    padding: 6px 12px !important;
    font-size: 12px !important;
    min-height: 32px !important;
  }

  .secondary-actions-grid {
    gap: 6px !important;
  }

  .btn-secondary-action {
    padding: 4px 6px !important;
    font-size: 11px !important;
    min-height: 26px !important;
  }
}