*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #000000;
  --bg-card: rgba(12, 12, 12, 0.88);
  --bg-card-hover: rgba(20, 18, 10, 0.92);
  --ochre: #c9a227;
  --ochre-light: #e8c84a;
  --ochre-dim: #8a7420;
  --ochre-muted: #6b5c1e;
  --text: #d4a843;
  --text-dim: #8a7420;
  --border: rgba(201, 162, 39, 0.18);
  --border-hover: rgba(232, 200, 74, 0.4);
  --radius: 12px;
  --font: 'Outfit', system-ui, sans-serif;
}

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

.bg-scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 70%, rgba(201, 162, 39, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 25%, rgba(201, 162, 39, 0.04) 0%, transparent 45%),
    #000000;
}

.bg-scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('/bg.svg') center / cover no-repeat;
}

.bg-scene::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
}

.header {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  transition: opacity 0.2s;
}

.logo:hover {
  opacity: 0.9;
}

.logo-icon {
  width: clamp(44px, 6vw, 56px);
  height: clamp(44px, 6vw, 56px);
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(201, 162, 39, 0.35));
}

.logo-text {
  font-size: clamp(1.35rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ochre-light);
  line-height: 1;
}

.logo-accent {
  color: var(--text);
  font-weight: 500;
}

.page {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.25rem, 3vh, 2.5rem);
  padding: 0 2rem;
  min-height: 0;
}

.hero {
  text-align: center;
  max-width: 600px;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 0.6rem;
  color: var(--ochre-light);
}

.highlight {
  color: var(--text);
}

.hero-sub {
  font-size: clamp(0.85rem, 1.8vw, 1rem);
  color: var(--text-dim);
}

.services {
  width: 100%;
  max-width: 1200px;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.6rem, 1.2vw, 1rem);
}

.card {
  width: clamp(9.5rem, 18vw, 11.5rem);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 2.5vw, 1.75rem) clamp(0.75rem, 1.5vw, 1rem);
  transition: all 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(201, 162, 39, 0.1);
}

.card-icon {
  width: clamp(56px, 8vw, 72px);
  height: clamp(56px, 8vw, 72px);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(201, 162, 39, 0.1);
  color: var(--ochre-light);
}

.card-icon svg {
  width: clamp(32px, 5vw, 42px);
  height: clamp(32px, 5vw, 42px);
}

.card-icon--telegram { color: #5bc0f0; background: rgba(91, 192, 240, 0.1); }
.card-icon--teamspeak { background: transparent; padding: 0; }
.card-icon--teamspeak svg { width: 100%; height: 100%; }
.card-icon--irc { background: transparent; padding: 0; }
.card-icon--irc svg { width: 100%; height: 100%; }
.card-icon--steam { color: #8ec8e8; background: rgba(142, 200, 232, 0.1); }
.card-icon--leetify { color: #5cdb95; background: rgba(92, 219, 149, 0.1); }

.card-name {
  font-size: clamp(0.8rem, 1.3vw, 0.95rem);
  font-weight: 600;
  color: var(--ochre-light);
}

.card-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: clamp(0.65rem, 1vw, 0.75rem);
  color: var(--text-dim);
}

.card-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ochre-muted);
  flex-shrink: 0;
  transition: background 0.3s, box-shadow 0.3s;
}

.card-status-dot--online {
  background: #5cdb7a;
  box-shadow: 0 0 6px rgba(92, 219, 122, 0.5);
}

.card-status-dot--offline {
  background: #e05a5a;
  box-shadow: 0 0 6px rgba(224, 90, 90, 0.35);
}

.card-status-dot--unknown {
  background: var(--ochre-light);
  box-shadow: 0 0 6px rgba(232, 200, 74, 0.35);
}

.card--offline .card-status {
  color: #c07070;
}

.widget-toggle {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-hover);
  border-radius: 999px;
  background: rgba(12, 12, 12, 0.92);
  color: var(--ochre-light);
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
}

.widget-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
}

.widget-toggle--irc:hover,
.widget-toggle--irc.widget-toggle--active {
  background: var(--bg-card-hover);
  border-color: var(--ochre-light);
  transform: translateY(-2px);
}

.chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 4.75rem;
  z-index: 40;
  width: min(24rem, calc(100vw - 2.5rem));
  display: none;
  flex-direction: column;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  background: rgba(8, 8, 8, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transition: width 0.2s ease, height 0.2s ease, inset 0.2s ease;
}

.chat-panel--open {
  display: flex;
}

.irc-widget {
  height: min(32rem, calc(100vh - 7rem));
}

.chat-panel--expanded {
  inset: 0.75rem;
  width: auto;
  height: auto;
  max-height: none;
  z-index: 50;
  border-radius: 10px;
}

.irc-widget.chat-panel--expanded {
  height: auto;
}

body.irc-widget-fullscreen .widget-toggle {
  opacity: 0;
  pointer-events: none;
}

.chat-widget-header {
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 12, 12, 0.98);
  pointer-events: auto;
}

.chat-widget-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ochre-light);
}

.chat-widget-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-widget-action {
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ochre-light);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.irc-widget-expand-icons {
  position: relative;
  display: block;
  width: 1rem;
  height: 1rem;
}

.irc-widget-expand-icons svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.irc-shrink-icon {
  display: none;
}

#irc-widget-expand.is-expanded .irc-expand-icon {
  display: none;
}

#irc-widget-expand.is-expanded .irc-shrink-icon {
  display: block;
}

.chat-widget-action:hover {
  background: rgba(201, 162, 39, 0.12);
}

.chat-widget-close {
  font-size: 1.5rem;
}

.chat-widget-body {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: row;
  background: #0d0d0d;
}

.chat-messages {
  flex: 1 1 auto;
  min-width: 0;
  overflow-y: auto;
  padding: 0.35rem 0;
  scrollbar-color: var(--ochre-dim) transparent;
}

.chat-messages::-webkit-scrollbar {
  width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: var(--ochre-dim);
  border-radius: 3px;
}

.chat-msg {
  display: grid;
  grid-template-columns: 3.6rem max-content minmax(0, 1fr);
  column-gap: 0.25rem;
  align-items: baseline;
  line-height: 1.4;
  padding: 0.15rem 0.5rem 0.15rem 0.35rem;
}

.chat-msg-time {
  text-align: right;
  font-size: 0.78em;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chat-msg-nick {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 7.5rem;
  padding-right: 0.15rem;
}

.chat-msg-body {
  min-width: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--text);
}

.chat-msg--traffic .chat-msg-body {
  grid-column: 2 / 4;
  opacity: 0.75;
  font-style: italic;
  font-size: 0.88em;
}

.chat-msg--system .chat-msg-body {
  grid-column: 1 / -1;
  opacity: 0.7;
  font-size: 0.85em;
  text-align: center;
  padding: 0.25rem 0;
}

.chat-nicklist {
  flex: 0 0 9.5rem;
  min-width: 0;
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 0.35rem 0;
  background: rgba(8, 8, 8, 0.6);
  scrollbar-color: var(--ochre-dim) transparent;
}

.chat-nick-item {
  padding: 0.12rem 0.5rem;
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-status {
  flex-shrink: 0;
  padding: 0.35rem 0.75rem;
  font-size: 0.72rem;
  color: var(--ochre-muted);
  border-top: 1px solid var(--border);
  background: rgba(10, 10, 10, 0.95);
}

.chat-status--connecting {
  color: var(--ochre-light);
}

.chat-status--online {
  color: #6fcf6f;
}

.chat-status--error {
  color: #e07070;
}

.chat-input-bar {
  flex-shrink: 0;
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.65rem;
  border-top: 1px solid var(--border);
  background: rgba(12, 12, 12, 0.98);
}

.chat-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  padding: 0.45rem 0.65rem;
  outline: none;
}

.chat-input:focus {
  border-color: var(--border-hover);
}

.chat-input:disabled {
  opacity: 0.5;
}

.chat-send {
  flex-shrink: 0;
  border: 1px solid var(--border-hover);
  border-radius: 6px;
  background: rgba(201, 162, 39, 0.12);
  color: var(--ochre-light);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
}

.chat-send:hover:not(:disabled) {
  background: rgba(201, 162, 39, 0.22);
}

.chat-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.footer {
  position: relative;
  z-index: 10;
  flex-shrink: 0;
  text-align: center;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  font-size: 0.75rem;
  color: var(--ochre-muted);
}

@media (max-width: 900px) {
  .card {
    width: clamp(9rem, 42vw, 11.5rem);
  }
}

@media (max-width: 600px) {
  .header {
    padding: 0.75rem 1.25rem;
  }

  .page {
    padding: 0 1.25rem;
    gap: 1rem;
  }

  .card {
    width: calc(50% - 0.5rem);
    max-width: 11.5rem;
  }

  .chat-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
    bottom: auto;
    transition: none;
  }

  .irc-widget {
    height: calc(100dvh - 1rem);
    height: calc(100vh - 1rem);
    max-height: none;
  }

  .irc-widget.chat-panel--open,
  body.irc-widget-mobile-open .irc-widget {
    position: fixed;
    z-index: 50;
  }

  .chat-panel--expanded {
    inset: 0.5rem;
    top: auto;
    right: 0.5rem;
    left: 0.5rem;
    bottom: auto;
    width: auto;
    height: calc(100dvh - 1rem);
    height: calc(100vh - 1rem);
  }

  body.irc-widget-mobile-open .widget-toggle {
    opacity: 0;
    pointer-events: none;
  }

  .widget-toggle {
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .chat-nicklist {
    flex-basis: 5.5rem;
  }

  .chat-msg {
    grid-template-columns: 3.2rem max-content minmax(0, 1fr);
  }

  .chat-msg-nick {
    max-width: 5rem;
  }
}

@media (max-height: 500px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-sub {
    display: none;
  }
}