:root {
  --ce-card-bg: rgba(255, 249, 233, .94);
  --ce-card-alt: #f5f3dc;
  --ce-text: #244f59;
  --ce-muted: #708078;
  --ce-accent: #159bd3;
  --ce-accent-2: #20bfae;
  --ce-cheerful: #ffad5d;
  --ce-success: #43b978;
  --ce-border: rgba(85, 117, 104, .34);
  --ce-shadow: 0 12px 32px rgba(35, 62, 55, .22);
  --ce-body-font: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  --ce-display-font: Georgia, Times New Roman, serif;
}

body.cruise-tv-mode {
  background:
    radial-gradient(circle at 8% 8%, rgba(36, 179, 206, .18), transparent 28%),
    radial-gradient(circle at 94% 92%, rgba(255, 173, 93, .17), transparent 30%),
    var(--ce-page-bg, #0a2943) !important;
  font-family: var(--ce-body-font) !important;
}

body.cruise-tv-mode main#map {
  border: var(--ce-frame-width, 2px) solid var(--ce-frame-color, #0b3655) !important;
  background: #d9dfd1 !important;
}

body.cruise-tv-mode main#map::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 431;
  pointer-events: none;
  opacity: .12;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, .82) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 72%, rgba(41, 106, 103, .24) 0 1px, transparent 1.5px);
  background-size: 24px 24px, 31px 31px;
  mix-blend-mode: soft-light;
}

body.cruise-tv-mode .cruise-design-widget {
  --ce-widget-bg: var(--ce-card-bg);
  --ce-widget-text: var(--ce-text);
  --ce-widget-muted: var(--ce-muted);
  --ce-widget-accent: var(--ce-accent);
  --ce-widget-border: var(--ce-border);
  color: var(--ce-widget-text) !important;
  border-color: var(--ce-widget-border) !important;
  font-family: var(--ce-body-font) !important;
  transform-origin: center center;
}

body.cruise-tv-mode aside.panel .cruise-design-widget.status,
body.cruise-tv-mode aside.panel .cruise-design-widget.card,
body.cruise-tv-mode aside.panel > .grid > .cruise-design-widget.card,
body.cruise-tv-mode #cruise-tour-title.cruise-design-widget,
body.cruise-tv-mode #cruise-coming-up.cruise-design-widget,
body.cruise-tv-mode #cruise-progress.cruise-design-widget,
body.cruise-tv-mode #capital-card.cruise-design-widget,
body.cruise-tv-mode #nextdest-card.cruise-design-widget,
body.cruise-tv-mode #cruise-map-badge.cruise-design-widget {
  background: var(--ce-widget-bg) !important;
  border: 1px solid var(--ce-widget-border) !important;
  box-shadow: var(--ce-widget-shadow, var(--ce-shadow)) !important;
  backdrop-filter: blur(11px) saturate(.94) !important;
  -webkit-backdrop-filter: blur(11px) saturate(.94) !important;
}

body.cruise-tv-mode .cruise-design-widget.card,
body.cruise-tv-mode #cruise-tour-title.cruise-design-widget,
body.cruise-tv-mode #cruise-coming-up.cruise-design-widget,
body.cruise-tv-mode #capital-card.cruise-design-widget,
body.cruise-tv-mode #nextdest-card.cruise-design-widget {
  position: fixed;
  overflow: hidden;
}

body.cruise-tv-mode .cruise-design-widget.card::after,
body.cruise-tv-mode #cruise-tour-title.cruise-design-widget::after,
body.cruise-tv-mode #cruise-coming-up.cruise-design-widget::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 0;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, transparent, var(--ce-widget-accent), transparent);
  opacity: .9;
  pointer-events: none;
}

body.cruise-tv-mode #metric-river-card,
body.cruise-tv-mode #metric-sun-card,
body.cruise-tv-mode #metric-distance-card,
body.cruise-tv-mode #metric-speed-card {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px !important;
}

body.cruise-tv-mode #metric-river-card .value,
body.cruise-tv-mode #metric-sun-card .value,
body.cruise-tv-mode #metric-distance-card .value,
body.cruise-tv-mode #metric-speed-card .value {
  color: var(--ce-widget-text) !important;
  font-family: var(--ce-display-font) !important;
}

body.cruise-tv-mode .cruise-design-widget .label,
body.cruise-tv-mode .cruise-design-widget .sub,
body.cruise-tv-mode .cruise-design-widget .k,
body.cruise-tv-mode .cruise-design-widget .cu-head,
body.cruise-tv-mode .cruise-design-widget .ct-vessel {
  color: var(--ce-widget-muted) !important;
}

body.cruise-tv-mode #cruise-tour-title .ct-title-main,
body.cruise-tv-mode .progress-card .progress-city,
body.cruise-tv-mode #arrive-weather-card .wx-title,
body.cruise-tv-mode #cruise-progress .cp-title {
  color: var(--ce-widget-text) !important;
  font-family: var(--ce-display-font) !important;
}

body.cruise-tv-mode #cruise-tour-title .ct-vessel,
body.cruise-tv-mode #cruise-progress .cp-pct,
body.cruise-tv-mode .progress-card #sched-pct {
  color: color-mix(in srgb, var(--ce-widget-accent) 82%, #06344c) !important;
  border-color: color-mix(in srgb, var(--ce-widget-accent) 32%, transparent) !important;
  background: color-mix(in srgb, var(--ce-widget-accent) 12%, transparent) !important;
}

body.cruise-tv-mode .progress-card > .label::before {
  content: none !important;
}

body.cruise-tv-mode .progress-card #sched-bar,
body.cruise-tv-mode #cruise-progress #cp-bar {
  background: linear-gradient(90deg, var(--ce-accent-2), var(--ce-accent), var(--ce-accent-2)) !important;
  background-size: 180% 100% !important;
}

body.cruise-tv-mode #status-card .dot.ok {
  background: var(--ce-success) !important;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--ce-success) 16%, transparent) !important;
}

body.cruise-tv-mode #cruise-coming-up .cu-dot {
  background: var(--ce-success) !important;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ce-success) 13%, transparent) !important;
}

body.cruise-tv-mode #arrive-weather-card::before {
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--ce-cheerful) 26%, transparent), transparent 62%) !important;
}

body.cruise-tv-mode #cruise-tv-hud.cruise-design-widget {
  pointer-events: none;
}

body.cruise-tv-mode #cruise-tv-hud .ctv-compact,
body.cruise-tv-mode #cruise-tv-hud .ctv-expanded {
  color: var(--ce-text) !important;
  background: var(--ce-card-bg) !important;
  border-color: var(--ce-border) !important;
  box-shadow: var(--ce-shadow) !important;
}

body.cruise-tv-mode .maplibregl-canvas {
  filter: saturate(var(--ce-map-saturation, .86)) brightness(var(--ce-map-brightness, 1.04)) contrast(var(--ce-map-contrast, .96));
}

body.cruise-editor-mode {
  overflow: hidden !important;
}

body.cruise-editor-mode .cruise-design-widget {
  cursor: grab !important;
  pointer-events: auto !important;
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  transition: outline-color .12s ease, box-shadow .12s ease !important;
}

body.cruise-editor-mode .cruise-design-widget:hover {
  outline: 2px dashed rgba(10, 152, 211, .82) !important;
  outline-offset: 3px !important;
}

body.cruise-editor-mode .cruise-design-widget[data-ce-selected="true"] {
  outline: 3px solid #16a9e1 !important;
  outline-offset: 4px !important;
}

body.cruise-editor-mode.ce-editor-dragging .cruise-design-widget[data-ce-selected="true"] {
  cursor: grabbing !important;
  box-shadow: 0 18px 48px rgba(3, 70, 99, .34) !important;
}

#ce-editor-selection {
  position: fixed;
  z-index: 2147483000;
  display: none;
  pointer-events: none;
  box-sizing: border-box;
  border: 2px solid #16a9e1;
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .94), 0 0 0 5px rgba(22, 169, 225, .12);
}

#ce-editor-selection.ce-visible {
  display: block;
}

#ce-editor-selection .ce-editor-label {
  position: absolute;
  left: -2px;
  top: -31px;
  max-width: 260px;
  padding: 6px 9px;
  overflow: hidden;
  color: #fff;
  background: #087eaf;
  border-radius: 8px 8px 8px 0;
  font: 700 12px/1.2 Inter, system-ui, sans-serif;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-shadow: 0 4px 14px rgba(0, 63, 91, .25);
}

#ce-editor-selection .ce-editor-resize {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 20px;
  height: 20px;
  pointer-events: auto;
  cursor: nwse-resize;
  border: 3px solid #fff;
  border-radius: 6px;
  background: #16a9e1;
  box-shadow: 0 2px 10px rgba(0, 68, 98, .4);
}

#ce-editor-selection .ce-editor-resize::before,
#ce-editor-selection .ce-editor-resize::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 2px;
  transform: rotate(-45deg);
  transform-origin: right center;
  background: #fff;
  border-radius: 999px;
}

#ce-editor-selection .ce-editor-resize::after {
  right: 1px;
  bottom: 1px;
  width: 11px;
}

body.ce-editor-preview .cruise-design-widget {
  cursor: default !important;
  pointer-events: none !important;
  outline: 0 !important;
}

body.ce-editor-preview #ce-editor-selection {
  display: none !important;
}

@media (max-width: 820px) {
  body.cruise-tv-mode .cruise-design-widget {
    position: fixed !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.cruise-tv-mode *,
  body.cruise-tv-mode *::before,
  body.cruise-tv-mode *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

body.cruise-tv-mode .cruise-live-stack {
  --cruise-live-accent: var(--ce-accent);
}

body.cruise-tv-mode .cruise-live-leader {
  background: linear-gradient(180deg, #294f54, var(--cruise-live-accent)) !important;
}

body.cruise-tv-mode .cruise-live-mapdot {
  background: var(--cruise-live-accent) !important;
  box-shadow: 0 0 0 2px rgba(10,103,147,.66), 0 0 18px rgba(26,166,221,.58) !important;
}

body.cruise-tv-mode .cruise-live-mapdot i,
body.cruise-tv-mode .cruise-live-mapdot b {
  border-color: var(--cruise-live-accent) !important;
}

/* Editor interaction override: the public TV layout intentionally disables
   pointer events on floating cards. In Design Studio every registered card
   must become selectable and draggable without making the empty panel block
   map interaction. */
body.cruise-tv-mode.cruise-editor-mode aside.panel > .cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode aside.panel > .grid > .cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #cruise-progress.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #cruise-tour-title.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #cruise-coming-up.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #cruise-tv-hud.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #capital-card.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #nextdest-card.cruise-design-widget,
body.cruise-tv-mode.cruise-editor-mode #cruise-map-badge.cruise-design-widget {
  pointer-events: auto !important;
}

body.cruise-tv-mode.cruise-editor-mode aside.panel > .grid {
  pointer-events: none !important;
}

body.cruise-tv-mode.cruise-editor-mode .cruise-design-widget:hover {
  transform: none !important;
}
