/* --- Game screen --- */
#app {
  display: none;
  position: relative;
  grid-template-columns: minmax(620px, 1fr) 300px 330px;
  grid-template-rows: auto minmax(0, 1fr) 164px;
  gap: 10px;
  padding: 12px;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 42% 44%, rgba(98,209,200,0.12), transparent 34%),
    radial-gradient(circle at 74% 82%, rgba(240,179,90,0.1), transparent 28%);
}

#topbar {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  background: rgba(13,20,27,0.92);
  border: 1px solid rgba(132,153,166,0.28);
  border-radius: 4px;
  flex-wrap: wrap;
  box-shadow: 0 14px 34px rgba(0,0,0,0.24), inset 0 1px 0 rgba(255,255,255,0.04);
}
#topbar h1 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: 2px;
  margin-right: auto;
}
#topbar .info {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0;
}
#topbar button {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  transition: all 0.2s;
}
#btn-execute {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 700;
}
#btn-execute:hover:not(:disabled) { background: #ffc36c; transform: translateY(-1px); }
#btn-execute:disabled { background: #1b2630; border-color: #2c3a45; color: #6f7f81; cursor: not-allowed; }
#btn-reset { background: transparent; color: var(--text-dim); }
#btn-reset:hover { color: var(--text); border-color: var(--text-dim); }

#mode-badge {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 1px;
}
#mode-badge.local { background: rgba(18,27,36,0.84); color: var(--text-dim); border: 1px solid var(--border); }
#mode-badge.online { background: rgba(90,158,126,0.12); color: var(--jade); border: 1px solid var(--jade); }

#phase-text {
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 12px;
  transition: all 0.5s;
}

#resolution-timeline {
  display: none;
  grid-row: 2 / 4;
  grid-column: 2;
  align-self: stretch;
  flex-direction: column;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid rgba(240,179,90,0.42);
  border-radius: 4px;
  background: linear-gradient(180deg, rgba(12,18,24,0.96), rgba(6,10,15,0.94));
  box-shadow: 0 14px 34px rgba(0,0,0,0.34);
  pointer-events: auto;
  overflow: hidden;
  max-height: 100%;
}
#resolution-timeline.show {
  display: flex;
}

#right-sidebar {
  grid-column: 3;
  grid-row: 2 / 4;
}
#resolution-timeline.complete {
  border-color: rgba(98,209,200,0.34);
}
#resolution-timeline[data-collapsed="1"] {
  gap: 6px;
}
#resolution-timeline[data-collapsed="1"] .resolution-timeline-body {
  display: none;
}
.resolution-timeline-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.resolution-timeline-title {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.resolution-timeline-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.resolution-active-speed {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
  line-height: 1.2;
}
.resolution-skip,
.resolution-timeline-toggle {
  pointer-events: auto;
  border: 1px solid rgba(240,179,90,0.42);
  background: rgba(240,179,90,0.08);
  color: var(--accent);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-family: var(--font-body);
  font-weight: 800;
}
.resolution-skip:hover,
.resolution-timeline-toggle:hover {
  background: rgba(240,179,90,0.16);
}
.resolution-timeline-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}
.resolution-axis {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
  max-height: min(44vh, 420px);
}
.resolution-phase {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid rgba(132,153,166,0.22);
  border-radius: 5px;
  background: rgba(17,25,34,0.86);
  color: var(--text-dim);
  transition: all 0.18s ease;
}
.resolution-phase.active {
  border-color: var(--accent);
  color: #fff6df;
  background: rgba(240,179,90,0.14);
  box-shadow: 0 0 0 1px rgba(240,179,90,0.22);
}
.resolution-phase.complete {
  border-color: rgba(98,209,200,0.34);
  color: var(--text);
  background: rgba(98,209,200,0.08);
}
.resolution-phase-head {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}
.resolution-phase-label {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1px;
}
.resolution-phase-count {
  font-size: 11px;
  line-height: 1.35;
  color: inherit;
}
.resolution-phase-end {
  min-width: 0;
}
.resolution-action-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.resolution-action-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 8px 9px;
  border: 1px solid rgba(132,153,166,0.18);
  border-radius: 6px;
  background: rgba(7,11,16,0.7);
}
.resolution-action-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(240,179,90,0.5);
  object-fit: cover;
  background: rgba(0,0,0,0.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}
.resolution-action-avatar-fallback {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(240,179,90,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  color: var(--accent);
  background: rgba(0,0,0,0.25);
}
.resolution-action-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.resolution-action-topline,
.resolution-action-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.resolution-action-actor {
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}
.resolution-action-player {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(132,153,166,0.24);
  color: var(--text-dim);
  font-size: 11px;
}
.resolution-action-skill-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid rgba(132,153,166,0.2);
  object-fit: contain;
  background: rgba(0,0,0,0.24);
}
.resolution-action-skill-name {
  color: var(--accent-2);
  font-weight: 800;
  font-size: 12px;
}
.resolution-action-summary {
  color: rgba(238,243,242,0.88);
  font-size: 12px;
  line-height: 1.45;
}
.resolution-action-effects {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.resolution-action-effect {
  color: rgba(238,243,242,0.88);
  font-size: 12px;
  line-height: 1.45;
}
.resolution-action-effect--status {
  font-size: 11px;
  color: rgba(200,210,215,0.78);
}
.resolution-complete {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

#selected-unit-drawer {
  position: absolute;
  left: 10px;
  top: 70px;
  bottom: 186px;
  width: 312px;
  z-index: 4;
  display: none;
  flex-direction: column;
  gap: 8px;
  background: rgba(10,15,21,0.96);
  border: 1px solid rgba(132,153,166,0.34);
  border-radius: 4px;
  padding: 12px;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(0,0,0,0.32);
}
#selected-unit-drawer.open { display: flex; }
.drawer-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.drawer-header .hud-section-label { margin: 0 auto 0 0; }
.drawer-close {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  color: var(--text-dim);
  cursor: pointer;
}
.drawer-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.drawer-empty,
.inspector-empty {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
}
.char-panel {
  background: linear-gradient(180deg, rgba(17,25,34,0.96), rgba(10,15,21,0.96));
  border: 1px solid rgba(132,153,166,0.26);
  border-radius: 4px;
  padding: 10px 12px;
  min-width: 170px;
}
.char-panel.mage { box-shadow: inset 3px 0 0 var(--purple); }
.char-panel.warrior { box-shadow: inset 3px 0 0 var(--red); }
.char-panel.shooter { box-shadow: inset 3px 0 0 var(--amber); }
.char-panel.opponent-panel { opacity: 0.65; }
.char-panel.info-only {
  min-width: 0;
  flex: 1;
  overflow: auto;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 6px;
}
.char-panel.mage .panel-title { color: var(--purple); }
.char-panel.warrior .panel-title { color: var(--red); }
.char-panel.shooter .panel-title { color: var(--amber); }

.resources { font-size: 12px; margin-bottom: 4px; }
.resources span { margin-right: 8px; }
.buffs { font-size: 12px; margin-bottom: 4px; min-height: 16px; }
.buffs .buff {
  display: inline-block;
  background: rgba(240,179,90,0.08);
  border: 1px solid rgba(240,179,90,0.18);
  padding: 1px 5px;
  border-radius: 2px;
  margin: 1px 2px;
  color: var(--accent);
}

.skill-grid { display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; min-height: 0; padding-right: 2px; }
.skill-btn {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(94,141,255,0.42);
  border-radius: 3px;
  background: #101923;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 12px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
}
.skill-btn:hover { background: #172635; border-color: var(--accent-2); }
.skill-btn.selected {
  background: #1b2f39;
  color: var(--text);
  border-color: var(--accent-2);
  font-weight: 700;
}
.skill-btn.selected .skill-name { color: var(--accent-2); }
.skill-btn.selected .skill-desc { color: rgba(238,243,242,0.78); }
.skill-btn.used { background: rgba(0,0,0,0.2); color: #555; border-color: #2a2a3a; cursor: not-allowed; }
.skill-btn.used .skill-name { color: var(--text-dim); }
.skill-btn.used .skill-desc { color: rgba(238,243,242,0.58); }
.skill-btn.opponent { opacity: 0.55; cursor: pointer; }
.skill-btn.opponent:hover { background: rgba(255,255,255,0.06); border-color: #535164; }
.skill-btn.used.opponent { cursor: pointer; }
.skill-btn.unaffordable { opacity: 0.42; }
.skill-btn.unaffordable:hover { opacity: 0.6; }

.skill-name { font-weight: 800; font-size: 15px; color: var(--text); }
.skill-desc { font-size: 12px; color: var(--text-dim); }

/* Pagination */
.skill-page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 4px 0;
  flex-shrink: 0;
}
.skill-page-btn {
  flex: 0 0 auto;
  padding: 2px 8px;
  border: 1px solid rgba(98,209,200,0.34);
  border-radius: 3px;
  background: rgba(18,27,36,0.92);
  color: var(--accent-2);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s;
}
.skill-page-btn:hover:not(:disabled) { background: rgba(98,209,200,0.14); color: var(--text); }
.skill-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.skill-page-indicator { font-size: 12px; color: #ffffff; min-width: 32px; text-align: center; }

/* Ripple effect for skill buttons */
.skill-btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(221,187,153,0.3);
  pointer-events: none;
  width: 20px;
  height: 20px;
  animation: ripple 0.6s ease-out forwards;
}

#canvas-wrap {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
  border-radius: 6px;
  background:
    radial-gradient(circle at center, rgba(98,209,200,0.08), transparent 58%),
    rgba(6,9,13,0.58);
  border: 1px solid rgba(132,153,166,0.16);
}
#canvas-wrap::before {
  content: "";
  position: absolute;
  inset: 10px;
  pointer-events: none;
  border: 1px solid rgba(98,209,200,0.16);
  background:
    linear-gradient(90deg, rgba(98,209,200,0.07) 1px, transparent 1px),
    linear-gradient(rgba(98,209,200,0.05) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 78%);
  animation: field-breathe 5s ease-in-out infinite;
}
canvas {
  border-radius: 6px;
  background: #0b1117;
  border: 1px solid rgba(98,209,200,0.26);
  cursor: crosshair;
  display: block;
  position: relative;
  z-index: 1;
  box-shadow: 0 20px 58px rgba(0,0,0,0.38), 0 0 0 1px rgba(255,255,255,0.02);
}

#action-dock {
  grid-row: 3;
  grid-column: 1;
  min-height: 0;
  height: 164px;
  display: grid;
  grid-template-columns: 224px 1fr 180px;
  gap: 10px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(17,25,34,0.96), rgba(8,12,17,0.97));
  border: 1px solid rgba(240,179,90,0.52);
  border-radius: 4px;
  padding: 10px;
  box-shadow: 0 -18px 42px rgba(0,0,0,0.34), inset 0 1px 0 rgba(255,255,255,0.04);
  overflow: hidden;
}
.dock-actor {
  border-right: 1px solid var(--border);
  padding-right: 10px;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.dock-actor .buffs {
  max-height: 48px;
  overflow-y: auto;
}
.dock-actor-label,
.hud-section-label {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 1px;
  margin-bottom: 5px;
}
.dock-actor-name {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.dock-skills {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dock-skills .skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 66px));
  grid-auto-rows: auto;
  gap: 6px;
  overflow-y: auto;
  padding: 4px 2px 8px 4px;
}
#action-dock .skill-icon-btn {
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  padding: 3px;
  border: 1px solid rgba(132,153,166,0.36);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(23,35,45,0.96), rgba(9,14,19,0.98));
  color: var(--text);
  position: relative;
  overflow: visible;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 4px 14px rgba(0,0,0,0.22);
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}
#action-dock .skill-icon-btn:hover:not(.used):not(.submitted) {
  border-color: rgba(98,209,200,0.78);
  background: linear-gradient(180deg, rgba(29,47,58,0.98), rgba(10,20,26,0.98));
  transform: translateY(-1px);
}
#action-dock .skill-icon-btn.selected {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(56,39,20,0.98), rgba(20,22,24,0.98));
  color: #fff6df;
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(255,246,223,0.7),
    0 0 0 3px rgba(240,179,90,0.82),
    0 8px 24px rgba(240,179,90,0.22),
    0 12px 24px rgba(0,0,0,0.32);
}
#action-dock .skill-icon-btn.selected::after {
  content: "";
  position: absolute;
  left: 9px;
  right: 9px;
  bottom: -7px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(240,179,90,0.82);
}
#action-dock .skill-icon-btn.used,
#action-dock .skill-icon-btn.submitted {
  opacity: 0.42;
  filter: grayscale(0.5);
  transform: none;
  border-color: rgba(83,81,100,0.55);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
#action-dock .skill-icon-btn.cooldown {
  /* Cooldown: visible but with grey radial overlay. Still clickable for preview. */
}
#action-dock .skill-icon-btn.no-uses {
  opacity: 0.4;
}
#action-dock .skill-icon-btn.unaffordable {
  opacity: 0.52;
}
/* Cooldown radial mask — grey area = remaining CD, starts at 12 o'clock, shrinks clockwise */
.skill-cd-mask {
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
  background: conic-gradient(
    from 0deg,
    transparent 0turn calc(var(--cd-elapsed-ratio, 0) * 1turn),
    rgba(18, 22, 26, 0.68) calc(var(--cd-elapsed-ratio, 0) * 1turn) 1turn
  );
}
#action-dock .skill-icon-btn:hover:not(.submitted):not(.used) .skill-cd-mask {
  background: conic-gradient(
    from 0deg,
    transparent 0turn calc(var(--cd-elapsed-ratio, 0) * 1turn),
    rgba(18, 22, 26, 0.4) calc(var(--cd-elapsed-ratio, 0) * 1turn) 1turn
  );
}

/* Cooldown radial edges — shared base */
@keyframes cooldown-edge-pulse {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}
.skill-cd-start-edge,
.skill-cd-progress-edge {
  position: absolute;
  inset: 3px;
  border-radius: 6px;
  pointer-events: none;
  z-index: 2;
}
/* Shared radial line from center to edge */
.skill-cd-start-edge::before,
.skill-cd-progress-edge::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 45%;
  transform-origin: center top;
  border-radius: 999px;
}
/* Fixed start edge — 12 o'clock, subtle */
.skill-cd-start-edge::before {
  background: rgba(240, 179, 90, 0.35);
  box-shadow: 0 0 4px rgba(240, 179, 90, 0.25);
  transform: rotate(0deg) translateY(-100%);
}
/* Dynamic progress edge — rotates clockwise with elapsed cooldown */
.skill-cd-progress-edge::before {
  background: rgba(240, 179, 90, 0.95);
  box-shadow: 0 0 6px rgba(240, 179, 90, 0.65);
  transform: rotate(var(--cd-edge-angle, 0deg)) translateY(-100%);
  animation: cooldown-edge-pulse 1.6s ease-in-out infinite;
}
.skill-glyph {
  position: absolute;
  inset: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(0,0,0,0.22);
}
.skill-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.skill-icon-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.skill-glyph span {
  display: none;
}
.skill-meta {
  position: absolute;
  bottom: 5px; left: 5px; right: 5px;
  display: flex;
  justify-content: center;
  gap: 4px;
  font-size: 10px;
  line-height: 1;
  padding: 2px 2px;
  background: rgba(6,9,13,0.72);
  color: #fff;
  border-radius: 5px;
  backdrop-filter: blur(2px);
}
.skill-meta span {
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 2px;
  background: rgba(0,0,0,0.25);
}
#action-dock .skill-icon-btn.selected .skill-meta {
  background: rgba(240,179,90,0.92);
  color: #211b14;
  font-weight: 700;
}
#action-dock .skill-icon-btn.selected .skill-meta span {
  background: rgba(255,246,223,0.42);
}
#skill-tooltip {
  position: fixed;
  z-index: 30;
  display: none;
  width: min(430px, calc(100vw - 16px));
  padding: 0;
  border: 1px solid rgba(240,179,90,0.66);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(240,179,90,0.1), transparent 34%),
    linear-gradient(180deg, rgba(16,24,32,0.99), rgba(5,8,12,0.99));
  color: var(--text);
  pointer-events: none;
  box-shadow:
    0 22px 52px rgba(0,0,0,0.52),
    0 0 0 1px rgba(255,255,255,0.04),
    inset 0 1px 0 rgba(255,255,255,0.07);
  white-space: normal;
}
#skill-tooltip.visible {
  display: block;
  animation: tooltip-rise 0.12s ease-out;
}
.skill-tooltip-card {
  position: relative;
  padding: 12px;
  overflow: hidden;
  border-radius: 8px;
}
.skill-tooltip-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(98,209,200,0.1);
  border-radius: 7px;
  pointer-events: none;
}
.skill-tooltip-card.mage { background: radial-gradient(circle at 12% 0%, rgba(165,117,255,0.16), transparent 32%); }
.skill-tooltip-card.warrior { background: radial-gradient(circle at 12% 0%, rgba(255,97,97,0.14), transparent 32%); }
.skill-tooltip-card.shooter { background: radial-gradient(circle at 12% 0%, rgba(240,179,90,0.15), transparent 32%); }
.skill-tooltip-header {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.skill-tooltip-icon {
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(240,179,90,0.74);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), transparent),
    rgba(0,0,0,0.36);
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 8px 20px rgba(0,0,0,0.28);
}
.skill-tooltip-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.skill-tooltip-title-wrap {
  min-width: 0;
}
.skill-tooltip-kicker {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.2;
  margin-bottom: 3px;
}
.skill-tooltip-title {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.1;
}
.skill-tooltip-meta {
  min-width: 82px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  font-size: 11px;
  line-height: 1.1;
}
.skill-tooltip-meta span,
.skill-tooltip-meta strong {
  display: inline-flex;
  max-width: 142px;
  justify-content: center;
  padding: 4px 7px;
  border: 1px solid rgba(98,209,200,0.34);
  border-radius: 999px;
  background: rgba(6,9,13,0.54);
  color: var(--accent-2);
  font-weight: 800;
  text-align: right;
}
.skill-tooltip-meta strong {
  border-color: rgba(240,179,90,0.5);
  color: #ffe1a8;
}
.skill-tooltip-rule {
  height: 1px;
  margin: 11px 0 10px;
  background: linear-gradient(90deg, rgba(240,179,90,0.62), rgba(98,209,200,0.22), transparent);
}
.skill-tooltip-body {
  color: rgba(238,243,242,0.91);
  font-size: 13px;
  line-height: 1.62;
  letter-spacing: 0.1px;
  text-wrap: pretty;
}
.skill-tooltip-highlight {
  color: #ffe1a8;
  font-weight: 800;
  text-shadow: 0 0 12px rgba(240,179,90,0.24);
}
.skill-tooltip-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 12px;
}
.skill-tooltip-stat-grid span {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(132,153,166,0.28);
  border-radius: 5px;
  background: rgba(6,9,13,0.42);
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
}
.skill-tooltip-stat-grid b {
  display: block;
  margin-bottom: 2px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
}
.skill-tooltip-card--inline {
  width: 100%;
  padding: 8px;
  border: 1px solid rgba(132,153,166,0.22);
  background: linear-gradient(180deg, rgba(14,22,29,0.95), rgba(6,9,13,0.9));
}
.skill-tooltip-card--inline::before {
  inset: 0;
  border-color: rgba(98,209,200,0.08);
}
.skill-tooltip-card--inline .skill-tooltip-header {
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 7px;
}
.skill-tooltip-card--inline .skill-tooltip-icon {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  font-size: 18px;
}
.skill-tooltip-card--inline .skill-tooltip-kicker {
  font-size: 10px;
  margin-bottom: 1px;
}
.skill-tooltip-card--inline .skill-tooltip-title {
  font-size: 15px;
  letter-spacing: 0;
}
.skill-tooltip-card--inline .skill-tooltip-meta {
  min-width: 54px;
  gap: 3px;
  font-size: 10px;
}
.skill-tooltip-card--inline .skill-tooltip-meta span,
.skill-tooltip-card--inline .skill-tooltip-meta strong {
  max-width: 76px;
  padding: 3px 5px;
}
.skill-tooltip-card--inline .skill-tooltip-rule {
  margin: 7px 0;
}
.skill-tooltip-card--inline .skill-tooltip-body {
  font-size: 11px;
  line-height: 1.45;
}
.skill-tooltip-card--inline .skill-tooltip-stat-grid {
  gap: 4px;
  margin-top: 8px;
}
.skill-tooltip-card--inline .skill-tooltip-stat-grid span {
  padding: 4px 3px;
  font-size: 11px;
}
.skill-tooltip-card--inline .skill-tooltip-stat-grid b {
  font-size: 9px;
}

@keyframes tooltip-rise {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #skill-tooltip.visible { animation: none; }
}

@media (max-width: 1020px) {
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) 150px 220px;
  }
  #resolution-timeline {
    max-height: 260px;
    grid-row: auto;
    grid-column: 1;
  }
  #right-sidebar {
    grid-row: 4;
    grid-column: 1 / -1;
  }
  #action-dock {
    grid-row: 3;
    height: 150px;
    grid-template-columns: 190px 1fr 160px;
  }
}

@media (max-width: 720px) {
  #app {
    padding: 8px;
    gap: 8px;
    grid-template-rows: auto minmax(0, 1fr) 210px 200px;
  }
  #resolution-timeline {
    padding: 8px 10px;
    max-height: 240px;
    grid-row: auto;
    grid-column: 1;
  }
  #topbar h1 {
    width: 100%;
  }
  #selected-unit-drawer {
    left: 8px;
    right: 8px;
    width: auto;
    top: 96px;
    bottom: 420px;
  }
  #action-dock {
    height: 210px;
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .dock-actor {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 8px;
  }
}
