:root {
  color-scheme: dark;
  --bg: #0d1017;
  --panel: #111722;
  --panel-strong: #151c28;
  --text: #edf1f7;
  --muted: #98a2b3;
  --line: rgba(148, 163, 184, 0.18);
  --accent: #42d392;
  --accent-strong: #21b97b;
  --danger: #ff6b7a;
  --shadow: 0 18px 52px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  padding-bottom: 34px;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 48px;
}

.hub-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 12px;
  flex: 0 1 480px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.75rem, 3.2vw, 3.35rem);
  font-weight: 760;
  line-height: 1;
}

.search-wrap {
  position: relative;
  flex: 1 1 300px;
  min-width: min(100%, 260px);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.15rem;
  pointer-events: none;
}

#searchInput {
  width: 100%;
  min-height: 48px;
  padding: 0 18px 0 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

#searchInput:focus {
  border-color: rgba(66, 211, 146, 0.55);
  box-shadow: 0 0 0 3px rgba(66, 211, 146, 0.1);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar p {
  margin: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.game-card {
  display: grid;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.032);
  color: var(--text);
  text-align: left;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.game-card:hover,
.game-card:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(66, 211, 146, 0.42);
  background: rgba(255, 255, 255, 0.052);
}

.game-card:focus-visible {
  outline: 3px solid rgba(66, 211, 146, 0.18);
  outline-offset: 3px;
}

.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 6px;
  object-fit: cover;
  background: var(--panel-strong);
}

.game-title {
  margin: 0 2px 2px;
  font-size: 0.96rem;
  font-weight: 700;
  line-height: 1.25;
}

.empty-state {
  margin: 72px 0 0;
  color: var(--muted);
  text-align: center;
}

.site-credit {
  position: fixed;
  right: 16px;
  bottom: 10px;
  left: 16px;
  z-index: 10;
  color: rgba(152, 162, 179, 0.72);
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  padding: 24px;
}

.modal.is-open {
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 8, 13, 0.78);
  backdrop-filter: blur(6px);
}

.modal-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 96vw);
  height: min(760px, 90vh);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0f16;
  box-shadow: var(--shadow);
}

.modal-panel.is-expanded {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.modal-header h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.control-button {
  min-height: 40px;
  min-width: 0;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-weight: 700;
}

.control-button:hover,
.control-button:focus-visible {
  border-color: rgba(66, 211, 146, 0.6);
  background: rgba(66, 211, 146, 0.1);
}

.control-button:focus-visible {
  outline: 3px solid rgba(66, 211, 146, 0.24);
  outline-offset: 2px;
}

.mute-button.is-muted {
  border-color: rgba(255, 207, 95, 0.72);
  background: rgba(255, 207, 95, 0.14);
  color: #ffe7a6;
}

.mute-button.is-muted:hover,
.mute-button.is-muted:focus-visible {
  border-color: rgba(255, 207, 95, 0.96);
  background: rgba(255, 207, 95, 0.2);
}

.close-button {
  border-color: rgba(255, 107, 122, 0.42);
  color: #ffd9de;
}

.close-button:hover,
.close-button:focus-visible {
  border-color: rgba(255, 107, 122, 0.84);
  background: rgba(255, 107, 122, 0.16);
}

.iframe-wrap {
  min-height: 0;
  background: #05070b;
}

#gameFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #05070b;
}

body.modal-lock {
  overflow: hidden;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding: 28px 0;
  }

  .hub-header {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .header-actions {
    align-items: stretch;
    flex-basis: auto;
    flex-direction: column-reverse;
  }

  .search-wrap {
    flex-basis: auto;
  }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .game-card {
    padding: 10px;
  }

  .modal {
    padding: 0;
  }

  .modal-panel {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
  }

  .modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
