:root {
  --bg-color: #0b0f19;
  --surface-color: #151d2f;
  --surface-hover: #1f2b42;
  --primary-color: #38bdf8;
  --primary-glow: rgba(56, 189, 248, 0.25);
  --accent-color: #f43f5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.08);
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  font-family: var(--font-family);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.portal-header {
  border-bottom: 1px solid var(--border-color);
  background: rgba(11, 15, 25, 0.85);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 1.5rem;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
}

.logo-badge {
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  box-shadow: 0 0 15px var(--primary-glow);
}

.logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.logo-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Search & Filter Bar */
.search-filter-section {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
  width: 100%;
}

.search-box-wrapper {
  position: relative;
  margin-bottom: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1.2rem 0.85rem 2.8rem;
  border-radius: 12px;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.category-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
}

.tab-btn {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--surface-hover);
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary-color);
  color: #04101d;
  border-color: var(--primary-color);
  box-shadow: 0 0 10px var(--primary-glow);
}

/* Random Play Button */
.random-btn {
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

.random-btn:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

/* Game Grid */
.game-grid-section {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1.5rem;
  width: 100%;
  flex: 1;
}

.grid-status {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

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

.game-card {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.card-thumb {
  width: 100%;
  height: 150px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 2.5rem;
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary-color);
}

.card-body {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

/* Play Page Specifics */
.play-container {
  max-width: 900px;
  margin: 1rem auto 2rem;
  padding: 0 1rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.game-frame-wrapper {
  width: 100%;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.game-frame-wrapper.portrait {
  max-width: 420px;
  aspect-ratio: 9 / 16;
}

.game-frame-wrapper.landscape {
  max-width: 860px;
  aspect-ratio: 16 / 9;
}

.game-frame-wrapper.square {
  max-width: 500px;
  aspect-ratio: 1 / 1;
}

.game-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.play-meta-bar {
  width: 100%;
  max-width: 860px;
  margin-top: 1.25rem;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.play-meta-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.play-title {
  font-size: 1.25rem;
  font-weight: 700;
}

.share-btn {
  background: #000;
  border: 1px solid #333;
  color: #fff;
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: background 0.2s ease;
}

.share-btn:hover {
  background: #222;
}

.ad-slot-placeholder {
  width: 100%;
  max-width: 860px;
  min-height: 90px;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Footer */
.portal-footer {
  border-top: 1px solid var(--border-color);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: auto;
}
