:root {
  --bg: #05030d;
  --bg-soft: #12071f;
  --panel: rgba(19, 12, 38, 0.86);
  --panel-strong: rgba(30, 16, 56, 0.94);
  --line: rgba(122, 114, 255, 0.4);
  --line-strong: rgba(122, 114, 255, 0.75);
  --text: #f7f3ff;
  --muted: #c9c2de;
  --accent: #8d59ff;
  --accent-soft: #5a58d6;
  --hot: #f35b8e;
  --green: #89ffb1;
  --shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
  --radius: 24px;
  --font-sans: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(141, 89, 255, 0.22), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(90, 88, 214, 0.16), transparent 24rem),
    linear-gradient(180deg, #04020b 0%, #090410 100%);
  color: var(--text);
  font-family: var(--font-sans);
  cursor: url("../img/carrot.png"), auto;
}

img,
canvas,
iframe {
  max-width: 100%;
}

a,
button,
input,
textarea,
select,
audio {
  cursor: url("../img/carrot.png"), auto;
}

a {
  color: inherit;
  text-decoration: none;
}

.ambient-glow {
  pointer-events: none;
  position: fixed;
  z-index: 0;
  width: 24rem;
  height: 24rem;
  filter: blur(80px);
  opacity: 0.45;
}

.ambient-glow-a {
  top: 0;
  left: -6rem;
  background: rgba(141, 89, 255, 0.4);
}

.ambient-glow-b {
  right: -6rem;
  bottom: 4rem;
  background: rgba(80, 128, 255, 0.28);
}

.site-border {
  pointer-events: none;
  position: fixed;
  inset: 0;
  border: 4px solid #5959ab;
  z-index: 0;
}

.site-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: 0.35rem;
}

.site-nav {
  background: rgba(20, 9, 38, 0.84);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  padding: 0.95rem 1.1rem;
}

.site-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-copy {
  display: grid;
  gap: 0.2rem;
}

.brand-copy strong {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.brand-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 0.65rem;
}

.nav-toggle-bar {
  display: block;
  width: 1.35rem;
  height: 2px;
  background: white;
}

.nav-toggle-bar + .nav-toggle-bar {
  margin-top: 0.22rem;
}

.nav-collapse {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.95rem;
}

.nav-links,
.nav-meta,
.button-row,
.section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-links {
  flex-wrap: wrap;
}

.nav-link {
  padding: 0.72rem 1rem;
  border-radius: 14px;
  color: var(--muted);
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: rgba(141, 89, 255, 0.18);
  color: white;
  transform: translateY(-1px);
}

.nav-user,
.nav-points {
  padding: 0.65rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.88rem;
}

.nav-points {
  color: var(--green);
}

.flash-stack {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(12, 8, 26, 0.92);
  box-shadow: var(--shadow);
}

.flash-success {
  border-color: rgba(137, 255, 177, 0.45);
}

.flash-error {
  border-color: rgba(243, 91, 142, 0.4);
}

.flash-info {
  border-color: rgba(90, 88, 214, 0.5);
}

.flash-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
}

.page-main {
  display: grid;
  gap: 1.5rem;
  padding-top: 1.5rem;
}

.hero,
.page-grid {
  display: grid;
  gap: 1.25rem;
}

.hero {
  grid-template-columns: 1.3fr 1fr;
}

.hero-home-clean {
  grid-template-columns: 1fr;
}

.panel,
.card,
.list-card,
.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel,
.card,
.list-card {
  padding: 1.3rem;
}

.mini-card {
  padding: 0.95rem 1rem;
}

.hero-panel {
  min-height: 100%;
}

.hero-copy {
  padding: 2rem;
}

.hero-home .hero-copy {
  background:
    linear-gradient(135deg, rgba(141, 89, 255, 0.18), rgba(90, 88, 214, 0.08)),
    var(--panel-strong);
}

.hero-copy-clean {
  max-width: 72rem;
}

.hero-home-clean .hero-copy {
  background:
    linear-gradient(135deg, rgba(141, 89, 255, 0.12), rgba(90, 88, 214, 0.04)),
    var(--panel-strong);
}

.hero-visual {
  padding: 1.5rem;
}

.section-block {
  display: grid;
  gap: 1.1rem;
}

.section-head {
  justify-content: space-between;
  flex-wrap: wrap;
}

.eyebrow,
.card-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(141, 89, 255, 0.16);
  color: #d9d0f0;
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.card-tag-hot {
  background: rgba(243, 91, 142, 0.16);
  color: #ffb7d0;
}

.page-title,
.section-title,
.card h3,
.panel h3 {
  margin: 0;
  font-family: var(--font-sans);
  letter-spacing: 0.01em;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.02;
}

.section-title {
  font-size: 1.4rem;
}

.lead,
.card-text,
.meta-text,
.list-card span,
.mini-card span,
.site-footer p {
  color: var(--muted);
  line-height: 1.65;
}

.lead {
  font-size: 1.02rem;
  max-width: 65ch;
}

.meta-text {
  font-size: 0.86rem;
}

.rotating-text {
  color: var(--green);
  font-weight: 600;
}

.quote-panel {
  margin-top: 1.4rem;
  padding: 1.1rem 1.15rem;
  border-radius: 18px;
  border: 1px solid rgba(137, 255, 177, 0.24);
  background: rgba(255, 255, 255, 0.04);
}

.quote-panel p {
  margin: 0 0 0.4rem;
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
}

.quote-panel span {
  color: var(--muted);
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}

.shot-grid img,
.feature-image {
  border-radius: 18px;
  border: 1px solid var(--line);
  object-fit: cover;
  width: 100%;
  min-height: 180px;
}

.stack-list {
  display: grid;
  gap: 0.9rem;
}

.compact-stack {
  gap: 0.65rem;
}

.page-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.page-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.page-grid-chat {
  grid-template-columns: 0.9fr 1.1fr;
}

.page-grid-chess {
  grid-template-columns: minmax(0, 1fr) 320px;
}

.card,
.list-card,
.mini-card,
.stat-card {
  display: grid;
  gap: 0.55rem;
}

.headline-link-card {
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.headline-link-card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.list-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 0.9rem 1.15rem;
  font-weight: 700;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-soft));
  color: white;
}

.button-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line);
  color: white;
}

.button-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--muted);
}

.button-small {
  padding: 0.7rem 0.95rem;
  border-radius: 14px;
  font-size: 0.9rem;
}

.text-link {
  color: var(--green);
  font-weight: 700;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.9rem;
}

.stat {
  display: grid;
  gap: 0.25rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat strong,
.stat-card strong {
  font-family: var(--font-sans);
  font-size: 1.7rem;
  font-weight: 700;
}

.stat span,
.stat-card span {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 1rem;
}

.form-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field-full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #e7ddff;
  font-weight: 600;
}

.text-input,
.text-area,
select.text-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  padding: 0.95rem 1rem;
  font: inherit;
}

.text-area {
  resize: vertical;
}

.text-input:focus,
.text-area:focus,
select.text-input:focus {
  outline: 2px solid rgba(141, 89, 255, 0.4);
  border-color: transparent;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.auth-card {
  width: min(560px, 100%);
}

.auth-card-wide {
  width: min(720px, 100%);
}

.table-shell {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.weather-table-shell {
  max-height: 70vh;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

.data-table th,
.data-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  background: rgba(20, 9, 38, 0.96);
  color: #f4f0ff;
}

.data-table audio {
  width: 190px;
}

.chat-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 1.25rem;
}

.ai-chat-stack {
  display: grid;
  gap: 1.25rem;
}

.ai-chat-compose-panel {
  max-width: 100%;
}

.chat-room-box,
.chat-history {
  display: grid;
  gap: 0.85rem;
  max-height: 32rem;
  overflow-y: auto;
  padding-right: 0.3rem;
}

.chat-history-panel {
  min-height: 0;
}

.admin-tile {
  display: grid;
  gap: 0.75rem;
  align-content: start;
  min-height: 100%;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.admin-tile:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
}

.button-row form {
  margin: 0;
}

.table-action-form {
  margin: 0;
}

.chat-line {
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-line p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  margin-top: 1rem;
}

.chat-bubble {
  padding: 1rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-bubble-user {
  background: rgba(141, 89, 255, 0.12);
}

.chat-bubble-bot {
  background: rgba(255, 255, 255, 0.05);
}

.chat-bubble-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.chat-bubble p {
  margin: 0.55rem 0 0;
}

.article-panel {
  gap: 1rem;
}

.article-paragraph {
  margin: 0;
  color: #f1ebff;
  line-height: 1.85;
}

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

.console-log {
  margin: 0;
  min-height: 28rem;
  max-height: 34rem;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #08120c;
  color: #caefcf;
  font-family: Consolas, "Liberation Mono", Menlo, Monaco, monospace;
  white-space: pre-wrap;
}

.game-panel {
  min-height: 18rem;
}

.game-panel-center {
  justify-items: center;
  text-align: center;
}

.game-panel-wide {
  padding: 0.8rem;
}

.game-input {
  max-width: 360px;
}

.game-canvas-full {
  display: block;
  width: 100%;
  min-height: 68vh;
  border-radius: 20px;
  background: #63228a;
}

.media-panel {
  gap: 1rem;
}

.media-frame {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding-top: 56.25%;
}

.media-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.move-history {
  max-height: 17rem;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.site-footer {
  margin-top: 1rem;
  padding: 1rem 0 0;
  text-align: center;
}

@media (max-width: 980px) {
  .hero,
  .page-grid-chat,
  .page-grid-chess,
  .chat-layout {
    grid-template-columns: 1fr;
  }

  .page-grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 1rem, 100%);
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .nav-collapse {
    display: none;
    flex-direction: column;
    align-items: stretch;
  }

  .nav-collapse.is-open {
    display: flex;
  }

  .nav-links,
  .nav-meta,
  .button-row {
    flex-wrap: wrap;
  }

  .page-grid-2,
  .page-grid-3,
  .page-grid-4,
  .form-grid-2 {
    grid-template-columns: 1fr;
  }

  .hero-copy,
  .panel,
  .card,
  .list-card {
    padding: 1.1rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }
}
