:root {
  color-scheme: dark;
  --bg: #08111b;
  --bg-soft: #0c1623;
  --bg-panel: linear-gradient(180deg, rgba(12, 20, 31, 0.96), rgba(10, 17, 27, 0.96));
  --border: rgba(225, 181, 76, 0.22);
  --border-strong: rgba(225, 181, 76, 0.42);
  --text: #f8f2e7;
  --text-soft: #b6c0cf;
  --gold: #e7b84f;
  --green: #42d37a;
  --danger: #ff6b5c;
  --info: #56b8ff;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  --radius-lg: 18px;
  --panel-padding: 12px;
  --panel-gap: 12px;
  --shell-padding: 10px;
  --topbar-h: 84px;
  --tab-height: 42px;
  --row-height: 28px;
  --tile-width: 220px;
  --tile-padding: 12px;
  --tile-title-size: 14px;
  --tile-time-size: 16px;
  --title-size: 32px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(231, 184, 79, 0.10), transparent 22%),
    linear-gradient(180deg, #071019, #08111b 48%, #060d16);
  color: var(--text);
  font-family: "Inter", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000;
}

.login-screen.is-hidden {
  display: none;
}

.login-card {
  width: min(430px, 100%);
  padding: 18px;
  border: 1px solid rgba(245, 214, 92, 0.28);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(8, 15, 21, 0.98), rgba(4, 8, 12, 0.98));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
}

.login-cat {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.login-copy h1 {
  margin: 0 0 16px;
  font-size: 34px;
  line-height: 1;
}

.login-field {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  color: var(--text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.login-field input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 13px 14px;
  font-size: 18px;
  font-weight: 800;
}

.login-field input:focus {
  border-color: rgba(98, 219, 138, 0.6);
  box-shadow: 0 0 0 3px rgba(98, 219, 138, 0.12);
}

.login-error {
  min-height: 22px;
  margin: 12px 0 0;
  color: #ff9b9b;
  font-weight: 800;
}

.login-btn,
.button-primary {
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--green), #22a962);
  color: #04120c;
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.login-btn {
  width: 100%;
  margin-top: 8px;
}

.app-shell {
  width: 100%;
  max-width: 1780px;
  height: 100dvh;
  margin: 0 auto;
  padding: var(--shell-padding);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.app-shell.is-hidden {
  display: none;
}

.topbar {
  min-height: var(--topbar-h);
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
}

.title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 2px 4px 2px 12px;
}

.title-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--gold);
  background: rgba(231, 184, 79, 0.14);
  border: 1px solid rgba(231, 184, 79, 0.24);
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--text-soft);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.title-group h1 {
  margin: 0;
  font-size: var(--title-size);
  line-height: 0.95;
  white-space: nowrap;
}

.map-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.map-tabs::-webkit-scrollbar {
  display: none;
}

.map-tab {
  min-height: var(--tab-height);
  padding: 0 18px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 19, 29, 0.85);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 160ms ease;
  white-space: nowrap;
  flex: 0 0 auto;
}

.map-tab.is-active {
  background: rgba(231, 184, 79, 0.12);
  border-color: var(--border-strong);
  box-shadow: inset 0 0 0 1px rgba(231, 184, 79, 0.18);
  color: #ffe7a6;
}

.panel {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  min-height: 0;
}

.online-card,
.side-panel {
  padding: var(--panel-padding);
}

.top-actions {
  display: flex;
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.sound-card {
  width: 178px;
  min-height: 100%;
  padding: 8px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 7px;
  align-content: center;
}

.sound-toggle {
  min-width: 0;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid rgba(66, 211, 122, 0.36);
  background:
    radial-gradient(circle at 50% 18%, rgba(66, 211, 122, 0.22), transparent 42%),
    rgba(9, 19, 29, 0.92);
  color: #b9ffd0;
  cursor: pointer;
}

.sound-toggle.is-muted {
  border-color: rgba(255, 107, 92, 0.46);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 107, 92, 0.18), transparent 42%),
    rgba(9, 19, 29, 0.92);
  color: #ffb4ac;
}

.sound-glyph {
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.volume-control {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.volume-control input {
  width: 100%;
  accent-color: var(--green);
}

.sound-test {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 11px;
  border: 1px solid rgba(231, 184, 79, 0.28);
  background: rgba(231, 184, 79, 0.08);
  color: #ffe7a6;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.online-card {
  min-width: 282px;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.online-card.is-collapsed {
  min-width: 168px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.panel-label {
  color: var(--gold);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.panel-hide,
.panel-chip,
.online-badge,
.tile-collapse,
.tile-icon,
.button-reset {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.panel-hide,
.tile-collapse {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.panel-chip {
  color: #ffce5a;
  text-transform: uppercase;
}

.panel-body {
  min-height: 0;
}

.panel.is-collapsed .panel-head {
  margin-bottom: 0;
}

.panel.is-collapsed .panel-body {
  display: none;
}

.online-list {
  display: grid;
  gap: 6px;
}

.online-item,
.online-person {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px rgba(66, 211, 122, 0.45);
  flex: 0 0 auto;
}

.dot-live {
  width: 10px;
  height: 10px;
}

.dot-info {
  background: var(--info);
  box-shadow: 0 0 12px rgba(86, 184, 255, 0.4);
}

.dashboard-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 330px;
  gap: var(--panel-gap);
  overflow: hidden;
}

.left-column,
.right-column {
  min-height: 0;
  display: grid;
  gap: var(--panel-gap);
  overflow: hidden;
}

.left-column {
  grid-template-rows: minmax(0, auto) minmax(0, 1fr);
}

.right-column {
  grid-template-rows: minmax(0, 1fr) minmax(0, 280px) minmax(0, 170px);
}

.right-column.notes-collapsed {
  grid-template-rows: minmax(0, 1fr) min-content minmax(0, 170px);
}

.right-column.chat-collapsed {
  grid-template-rows: minmax(0, 1fr) minmax(0, 280px) min-content;
}

.right-column.notes-collapsed.chat-collapsed {
  grid-template-rows: minmax(0, 1fr) min-content min-content;
}

.right-column.fastest-collapsed {
  grid-template-rows: min-content minmax(0, 1fr) minmax(0, 170px);
}

.right-column.fastest-collapsed.chat-collapsed {
  grid-template-rows: min-content minmax(0, 1fr) min-content;
}

.boss-panel,
.cycle-panel,
.fastest-panel,
.notes-panel,
.chat-panel {
  min-height: 0;
  overflow: hidden;
}

.fastest-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.notes-panel,
.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.boss-list,
.fastest-list,
.chat-log {
  display: grid;
  gap: 8px;
}

.fastest-list {
  max-height: 100%;
  overflow: auto;
  min-height: 0;
}

.boss-row,
.fastest-row,
.slot-pill {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.024);
}

.boss-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px 28px;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px 6px 10px;
}

.boss-channel {
  color: #ffc44d;
  font-size: 12px;
  font-weight: 800;
}

.boss-time {
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
}

.boss-action,
.boss-reset,
.tile-action,
.tile-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(66, 211, 122, 0.22);
  color: #b9ffd0;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.boss-reset,
.tile-more {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.field-label {
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.field-input,
.notes-input {
  width: 100%;
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(5, 10, 17, 0.56);
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.field-input:focus,
.notes-input:focus {
  border-color: rgba(231, 184, 79, 0.42);
  box-shadow: 0 0 0 3px rgba(231, 184, 79, 0.12);
}

.preset-row,
.next-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.preset-button,
.slot-pill {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.preset-button.is-active {
  border-color: rgba(231, 184, 79, 0.4);
  background: rgba(231, 184, 79, 0.12);
  color: #ffe7a6;
}

.countdown-card {
  margin-top: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.countdown-label,
.meta-line,
#mapNotesStatus {
  color: var(--text-soft);
  font-size: 12px;
}

.countdown-value {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  font-weight: 800;
}

.map-stage {
  min-height: 0;
  display: grid;
  overflow: hidden;
  padding: 14px;
}

.map-frame {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(231, 184, 79, 0.18);
  background: #02060c;
}

.map-image {
  position: absolute;
  inset: 0;
  object-fit: contain;
  display: block;
}

.tile-layer {
  position: absolute;
  inset: 0;
}

.resp-tile {
  position: absolute;
  width: var(--tile-width);
  min-width: var(--tile-width);
  padding: var(--tile-padding);
  border-radius: 18px;
  border: 1px solid rgba(231, 184, 79, 0.24);
  background: linear-gradient(180deg, rgba(13, 22, 33, 0.96), rgba(11, 17, 25, 0.94));
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(8px);
}

.resp-tile.is-collapsed {
  min-height: 0;
}

.tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.tile-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.tile-name-input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: var(--tile-title-size);
  font-weight: 800;
  text-transform: uppercase;
  padding: 0;
  outline: none;
}

.tile-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tile-minutes {
  color: #ffce5a;
  font-weight: 800;
  white-space: nowrap;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.tile-icon {
  width: 22px;
  height: 22px;
  border-radius: 8px;
  color: #ffd06a;
}

.tile-drag {
  cursor: grab;
}

.tile-drag.is-dragging {
  cursor: grabbing;
}

.channel-list,
.duplicate-panel {
  display: grid;
  gap: 6px;
}

.duplicate-panel {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.duplicate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
}

.duplicate-minutes {
  color: #8fd8ff;
  cursor: pointer;
}

.channel-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 28px 22px;
  gap: 6px;
  align-items: center;
  min-height: var(--row-height);
}

.channel-name {
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.channel-time {
  font-size: var(--tile-time-size);
  font-weight: 800;
  line-height: 1;
}

.is-idle {
  color: #c5ceda;
}

.is-running {
  color: #42d37a;
}

.is-warning {
  color: #ff6b5c;
}

.is-critical {
  color: #ffd24f;
  animation: pulse-warning 0.85s ease-in-out infinite alternate;
}

.is-expired {
  color: #ffb85c;
}

.tile-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tile-footer-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tile-footer-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid rgba(231, 184, 79, 0.18);
  background: rgba(231, 184, 79, 0.05);
  color: var(--gold);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.fastest-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px 10px;
}

.fastest-row.is-duplicate {
  border-color: rgba(96, 205, 255, 0.72);
  background: linear-gradient(180deg, rgba(29, 92, 139, 0.58), rgba(12, 42, 70, 0.46));
  box-shadow:
    inset 3px 0 0 #60cdff,
    inset 0 0 0 1px rgba(96, 205, 255, 0.26),
    0 0 18px rgba(96, 205, 255, 0.16);
}

.fastest-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.fastest-chip.is-duplicate {
  background: rgba(96, 205, 255, 0.26);
  color: #e7f8ff;
  border: 1px solid rgba(96, 205, 255, 0.72);
}

.fastest-meta {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.fastest-name {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fastest-name.is-duplicate {
  color: #e8faff;
}

.fastest-name.is-duplicate::after {
  content: " dodatkowy";
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(96, 205, 255, 0.2);
  color: #75d7ff;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  vertical-align: 1px;
}

.fastest-sub {
  color: var(--text-soft);
  font-size: 11px;
}

.fastest-sub.is-duplicate {
  color: #75d7ff;
  font-weight: 800;
  text-transform: uppercase;
}

.fastest-time {
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.fastest-empty {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.notes-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.notes-card h2 {
  margin: 0;
  font-size: 18px;
}

.notes-panel .panel-body {
  display: grid;
  min-height: 0;
}

.notes-input {
  min-height: 0;
  height: 100%;
  padding: 12px 14px;
  resize: none;
  line-height: 1.35;
}

.notes-footer,
.chat-compose {
  display: flex;
  align-items: center;
  gap: 10px;
}

.notes-footer {
  justify-content: space-between;
}

.notes-footer .button-primary {
  min-width: 84px;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.chat-log {
  max-height: 100%;
  overflow: auto;
  min-height: 0;
}

.chat-message {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 12px;
}

.chat-meta {
  margin-bottom: 4px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
}

.chat-input {
  flex: 1;
}

@keyframes pulse-warning {
  from {
    opacity: 1;
    text-shadow: 0 0 0 rgba(255, 210, 79, 0);
  }
  to {
    opacity: 0.6;
    text-shadow: 0 0 12px rgba(255, 210, 79, 0.45);
  }
}

@media (max-height: 850px) {
  :root {
    --panel-padding: 10px;
    --panel-gap: 10px;
    --shell-padding: 8px;
    --topbar-h: 74px;
    --tab-height: 38px;
    --row-height: 25px;
    --tile-width: 206px;
    --tile-padding: 10px;
    --tile-title-size: 13px;
    --tile-time-size: 14px;
    --title-size: 28px;
  }
}

@media (max-height: 760px) {
  :root {
    --panel-padding: 8px;
    --panel-gap: 8px;
    --shell-padding: 6px;
    --topbar-h: 66px;
    --tab-height: 34px;
    --row-height: 23px;
    --tile-width: 192px;
    --tile-padding: 9px;
    --tile-title-size: 12px;
    --tile-time-size: 13px;
    --title-size: 24px;
  }
}

@media (max-width: 1480px) {
  .dashboard-grid {
    grid-template-columns: 252px minmax(0, 1fr) 304px;
  }

  .topbar {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
  }

  .online-card {
    min-width: 254px;
  }
}

@media (max-width: 1180px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .topbar,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .map-tabs {
    order: 3;
  }

  .top-actions {
    order: 2;
  }

  .online-card {
    min-width: 0;
  }

  .left-column,
  .right-column {
    grid-template-rows: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .map-stage {
    min-height: 420px;
  }

  .title-group h1 {
    white-space: normal;
  }
}

@media (max-width: 900px) {
  .left-column,
  .right-column {
    grid-template-columns: 1fr;
  }

  .notes-footer,
  .chat-compose {
    flex-direction: column;
    align-items: stretch;
  }

  .resp-tile {
    width: 188px;
    min-width: 188px;
  }
}
