:root {
  --bg: #050816;
  --bg-soft: #0b1020;
  --bg-softer: #101528;
  --accent: #4f46e5;
  --accent-soft: rgba(79, 70, 229, 0.18);
  --accent-strong: #a855f7;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --chip-bg: #111827;
  --chip-active-bg: #1f2937;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.55);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --transition-fast: 150ms ease-out;
  --transition-med: 220ms ease-out;
  --font-main: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-main);
  background: radial-gradient(circle at top, #111827 0, #020617 42%, #020617 100%);
  color: var(--text-main);
}

.app-shell {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 28px;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(17, 24, 39, 0.9));
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 8px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 0%, #38bdf8, #4f46e5 45%, #a855f7 100%);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 18px;
  color: white;
}

.brand-text h1 {
  font-size: 18px;
  margin: 0;
}

.brand-text p {
  font-size: 12px;
  margin: 2px 0 0;
  color: var(--text-muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.pill-btn {
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  border: none;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition-med), color var(--transition-med),
    transform var(--transition-fast), box-shadow var(--transition-fast);
  font-weight: 500;
}

.pill-btn-outline {
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.55);
  color: var(--text-main);
}

.pill-btn-outline:hover {
  background: rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.75);
}

/* Layout */
.layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 16px;
}

/* Sidebar */
.sidebar {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 20px;
  padding: 14px 14px 16px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  align-self: flex-start;
}

.sidebar h2 {
  margin: 0 0 8px;
  font-size: 15px;
}

.sidebar h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--text-muted);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border-radius: var(--radius-pill);
  border: 1px solid rgba(75, 85, 99, 0.7);
  background: var(--chip-bg);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition-med), border-color var(--transition-med),
    color var(--transition-med), transform var(--transition-fast);
}

.chip:hover {
  transform: translateY(-1px);
  border-color: rgba(148, 163, 184, 0.9);
}

.chip-active {
  background: var(--chip-active-bg);
  border-color: var(--accent);
  color: #e5e7eb;
}

/* Session box */
.session-box {
  margin-top: 4px;
  padding: 10px 11px;
  border-radius: 14px;
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.08), transparent 70%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(17, 24, 39, 0.95));
  border: 1px solid rgba(51, 65, 85, 0.9);
}

.session-label {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

.session-time {
  margin: 2px 0 4px;
  font-size: 20px;
  font-weight: 600;
}

.session-hint {
  margin: 0;
  font-size: 11px;
  color: var(--text-muted);
}

/* Content */
.content {
  background: rgba(15, 23, 42, 0.96);
  border-radius: 20px;
  padding: 14px 14px 18px;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.search-input,
.select-input {
  border-radius: 999px;
  border: 1px solid rgba(55, 65, 81, 0.9);
  background: #020617;
  color: var(--text-main);
  padding: 8px 13px;
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-med), box-shadow var(--transition-med),
    background var(--transition-med);
}

.search-input {
  flex: 1 1 220px;
}

.select-input {
  flex: 0 0 150px;
}

.search-input::placeholder {
  color: #6b7280;
}

.search-input:focus,
.select-input:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 1px rgba(168, 85, 247, 0.5);
  background: #020617;
}

/* Game grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.game-card {
  position: relative;
  background: var(--bg-soft);
  border-radius: 16px;
  padding: 10px 10px 11px;
  border: 1px solid rgba(31, 41, 55, 0.9);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    border-color var(--transition-fast), background var(--transition-fast);
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 15px 42px rgba(15, 23, 42, 0.9);
  background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.16), #020617 56%);
}


.game-thumb {
  position: relative;
  height: 90px;
  border-radius: 12px;
  overflow: hidden;              /* important for rounded image */
  background: radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.2), transparent 50%),
    radial-gradient(circle at 80% 120%, rgba(244, 114, 182, 0.18), transparent 50%),
    #020617;
  border: 1px solid rgba(30, 64, 175, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #e5e7eb;
}

.game-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


.game-info {
  margin-top: 8px;
}

.game-title {
  font-size: 14px;
  margin: 0 0 2px;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
}

/* Empty state */
.empty-state {
  text-align: center;
  margin-top: 32px;
  padding: 24px 18px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px dashed rgba(55, 65, 81, 0.9);
}

.empty-state h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 40;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
}

.modal-dialog {
  position: relative;
  width: min(960px, 100% - 24px);
  height: min(640px, 100% - 24px);
  background: #020617;
  border-radius: 20px;
  border: 1px solid rgba(30, 64, 175, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.7);
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.98));
}

.modal-title-wrap h2 {
  margin: 0;
  font-size: 15px;
}

.modal-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.icon-btn {
  border-radius: 999px;
  border: 1px solid rgba(51, 65, 85, 0.9);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  width: 26px;
  height: 26px;
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--transition-med), transform var(--transition-fast),
    border-color var(--transition-med);
}

.icon-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(129, 140, 248, 0.95);
  background: rgba(15, 23, 42, 1);
}

.modal-body {
  flex: 1;
  padding: 8px 10px 10px;
}

#gameFrame {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #020617;
}

.modal-footer {
  padding: 8px 14px 10px;
  border-top: 1px solid rgba(30, 64, 175, 0.6);
  font-size: 11px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 860px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    order: 2;
  }

  .content {
    order: 1;
  }
}

@media (max-width: 600px) {
  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-dialog {
    height: calc(100% - 20px);
  }
}
