@font-face {
  font-family: "Smallest Pixel-7";
  src: url("./Smallest-Pixel7.woff") format("woff");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #3a0714;
  --bg-deep: #22030a;
  --panel: rgba(45, 4, 14, 0.88);
  --panel-hover: rgba(58, 5, 18, 0.92);
  --border: rgba(255, 92, 120, 0.22);
  --accent: #f02b55;
  --accent-hover: #ff4167;
  --text: #ffe8ed;
  --muted: #d39ba8;
  --danger: #ff224c;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: "Smallest Pixel-7", "Courier New", Courier, monospace;
  background:
    radial-gradient(circle at 50% 15%, rgba(240, 43, 85, 0.22), transparent 42%),
    linear-gradient(180deg, #4a0818 0%, var(--bg) 45%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

/* CRT scanlines */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.028) 0,
      rgba(255, 255, 255, 0.028) 1px,
      rgba(35, 0, 9, 0.055) 1px,
      rgba(35, 0, 9, 0.055) 3px
    );
  opacity: 0.72;
}

/* CRT vignette + subtle flicker */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 19;
  pointer-events: none;
  box-shadow:
    inset 0 0 130px rgba(20, 0, 6, 0.82),
    inset 0 0 24px rgba(255, 52, 91, 0.10);
  animation: crt-flicker 7s steps(1, end) infinite;
}

@keyframes crt-flicker {
  0%, 18%, 20%, 72%, 74%, 100% { opacity: 1; }
  19% { opacity: 0.94; }
  73% { opacity: 0.97; }
}

button,
input {
  font: inherit;
}

.site {
  position: relative;
  z-index: 1;
  width: min(900px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
}

.header {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
  text-transform: lowercase;
  text-shadow: 0 0 10px rgba(240, 43, 85, 0.42);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.status span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 9px rgba(240, 43, 85, 0.85);
}

.status b {
  font-weight: 400;
}

.screen {
  padding: 48px 0;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: calc(100vh - 62px);
  display: grid;
  place-items: center;
  padding-bottom: 90px;
}

.login-box,
.call-box {
  width: min(390px, 100%);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 0 30px rgba(66, 0, 18, 0.28);
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 1.2;
  font-weight: 700;
}

.login-box > p:first-of-type {
  margin: 7px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

input {
  width: 100%;
  height: 42px;
  margin-bottom: 14px;
  padding: 0 11px;
  color: var(--text);
  background: rgba(24, 1, 7, 0.78);
  border: 1px solid var(--border);
  border-radius: 0;
  outline: none;
  caret-color: var(--accent);
}

input:focus {
  border-color: rgba(240, 43, 85, 0.72);
  box-shadow: 0 0 0 1px rgba(240, 43, 85, 0.12);
}

.button {
  height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.button.primary {
  color: #2b020c;
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.secondary {
  color: var(--text);
  background: rgba(24, 1, 7, 0.35);
  border-color: var(--border);
}

.button.secondary:hover {
  background: var(--panel-hover);
  border-color: rgba(255, 109, 137, 0.38);
}

.button.danger {
  color: #ffb7c5;
  background: transparent;
  border-color: rgba(255, 34, 76, 0.48);
}

.button.danger:hover {
  color: #ffdce3;
  background: rgba(255, 34, 76, 0.10);
  border-color: var(--danger);
}

.login-box .button {
  width: 100%;
}

.error {
  min-height: 18px;
  margin: 11px 0 0;
  color: #ff9aae;
  font-size: 12px;
  line-height: 1.45;
}

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

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.operator-badge {
  color: var(--muted);
  font-size: 12px;
}

.calls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.call-card {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
}

.call-number {
  margin: 0 0 13px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}

.call-meta {
  display: grid;
  gap: 5px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.call-meta strong {
  color: #f3c8d1;
  font-weight: 400;
}

.call-card .button {
  width: 100%;
}

.empty {
  padding: 48px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  text-align: center;
  font-size: 12px;
}

.call-box {
  margin: 9vh auto 0;
  text-align: center;
}

.small {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.call-box h1 {
  color: var(--accent);
  font-size: 30px;
  text-shadow: 0 0 12px rgba(240, 43, 85, 0.26);
}

.call-state {
  margin: 12px 0 24px;
  color: var(--muted);
  font-size: 12px;
}

.call-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

@media (max-width: 650px) {
  .site {
    width: min(100% - 22px, 900px);
  }

  .header {
    min-height: 56px;
  }

  .screen {
    padding-top: 30px;
  }

  .login-screen {
    min-height: calc(100vh - 56px);
    padding-bottom: 70px;
  }

  .calls {
    grid-template-columns: 1fr;
  }

  .page-head {
    align-items: flex-start;
  }

  .head-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .operator-badge {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after {
    animation: none;
  }
}
