@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --bg: #0a0a0f;
  --bg-soft: #12121a;
  --bg-card: #16161f;
  --panel: #1c1c28;
  --panel-soft: #22222e;
  --line: #2a2a3a;
  --line-strong: #3a3a50;
  --text: #f0f0f5;
  --text-secondary: #a0a0b0;
  --muted: #6a6a7a;
  --accent: #00d4ff;
  --accent-strong: #00b8e6;
  --accent-soft: rgba(0, 212, 255, 0.1);
  --accent-glow: rgba(0, 212, 255, 0.3);
  --purple: #a855f7;
  --purple-soft: rgba(168, 85, 247, 0.1);
  --good: #10b981;
  --good-soft: rgba(16, 185, 129, 0.1);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px var(--accent-glow);
  --radius: 16px;
  --radius-lg: 24px;
  --header: 72px;
  --container: 1280px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image: 
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 255, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(168, 85, 247, 0.06), transparent),
    radial-gradient(ellipse 60% 40% at 0% 50%, rgba(168, 85, 247, 0.04), transparent);
  background-attachment: fixed;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; cursor: pointer; }
label[for] { cursor: pointer; }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid transparent; }
button:disabled { cursor: not-allowed; opacity: 0.5; }

::selection { background: var(--accent); color: var(--bg); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.hidden { display: none !important; }

.container { width: min(100% - 32px, var(--container)); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 120;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}

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

.brand { display: flex; align-items: center; gap: 14px; }
.brand-badge {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: var(--bg); font-weight: 900; font-size: 1.1rem;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.brand-copy { display: grid; gap: 2px; }
.brand-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }
.brand-subtitle { color: var(--muted); font-size: 0.85rem; }

.header-actions, .header-nav { display: flex; align-items: center; gap: 10px; }

.header-chip, .icon-btn, .input-shell, .primary-btn, .soft-btn, .ghost-btn, .copy-btn, .page-link, .player-shell, .panel, .rom-section, .home-choice {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}

.header-chip { 
  padding: 10px 16px; font-weight: 600; color: var(--text-secondary); 
  box-shadow: none; background: transparent;
  transition: all 0.2s ease;
}
.header-chip:hover { color: var(--text); background: var(--panel); }
.header-chip.is-active { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.icon-btn { 
  width: 44px; height: 44px; display: grid; place-items: center; padding: 0; 
  box-shadow: none; background: transparent;
  border-color: var(--line);
  transition: all 0.2s ease;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 160; pointer-events: none; }
.drawer.is-open { pointer-events: auto; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.7); opacity: 0; transition: 0.25s ease opacity; }
.drawer-panel {
  position: absolute; top: 0; right: 0; width: min(400px, 100%); height: 100%; 
  background: var(--bg-soft); border-left: 1px solid var(--line);
  transform: translateX(100%); transition: 0.3s ease transform; 
  padding: 20px; display: grid; grid-template-rows: auto auto 1fr; gap: 16px;
}
.drawer.is-open .drawer-backdrop { opacity: 1; }
.drawer.is-open .drawer-panel { transform: translateX(0); }
.drawer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-title { font-weight: 800; font-size: 1.2rem; }
.drawer-subtitle, .helper, .muted { color: var(--muted); }
.drawer-links { display: grid; gap: 10px; overflow: auto; }
.drawer-link {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px; border-radius: 18px; border: 1px solid var(--line); 
  background: var(--panel);
  transition: all 0.2s ease;
}
.drawer-link:hover { border-color: var(--accent); transform: translateX(-4px); }
.drawer-link strong { display: block; font-weight: 700; }
.drawer-link span { color: var(--muted); font-size: 0.9rem; }

/* Input Shell */
.input-shell { display: flex; align-items: center; min-height: 52px; padding: 0 16px; box-shadow: none; background: var(--panel-soft); border-color: var(--line); }
.input-shell input { width: 100%; border: 0; outline: 0; background: transparent; }
.input-shell input::placeholder { color: var(--muted); }

.rom-search.input-shell {
  position: relative;
  border: 2px solid var(--line);
  background: var(--panel-soft);
  box-shadow: none;
  min-height: 56px;
  padding-inline: 18px;
  transition: all 0.25s ease;
}
.rom-search.input-shell::before {
  content: '⌕';
  flex: 0 0 auto;
  margin-right: 12px;
  font-size: 1.2rem;
  color: var(--muted);
}
.rom-search.input-shell:focus-within { 
  border-color: var(--accent); 
  box-shadow: 0 0 0 4px var(--accent-soft), 0 8px 24px rgba(0, 0, 0, 0.3);
}
.rom-search.input-shell input::placeholder { color: var(--muted); }

/* Main Content */
main { padding-bottom: 60px; }
.hero, .page-hero { padding: 40px 0 24px; }
.simple-home { padding-top: 60px; }

/* Home Cards */
.home-two-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.home-choice { 
  padding: 36px; display: grid; gap: 16px; 
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}
.home-choice::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  opacity: 0;
  transition: opacity 0.3s ease;
}
.home-choice:hover { 
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), 0 0 40px var(--accent-soft);
}
.home-choice:hover::before { opacity: 1; }

.home-choice h1 { margin: 0; font-size: clamp(1.8rem, 3.5vw, 2.4rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.home-choice p, .page-hero p, .hero p { margin: 0; color: var(--text-secondary); font-size: 1rem; max-width: 50ch; line-height: 1.6; }

/* Feature Icon */
.feature-icon, .system-badge {
  width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; 
  font-weight: 900; font-size: 1.4rem;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 212, 255, 0.2);
  box-shadow: 0 0 30px var(--accent-glow);
}

/* Section Kicker */
.section-kicker {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; 
  padding: 8px 14px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 0.85rem;
  border: 1px solid rgba(0, 212, 255, 0.2);
}

/* Page Hero */
.page-hero-inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.page-hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.1; margin: 16px 0 14px; font-weight: 800; letter-spacing: -0.02em; }

/* Buttons */
.page-meta, .quick-actions, .rom-toolbar, .pager, .player-toolbar, .player-toolbar-group, .rom-top, .rom-actions, .rom-head, .footer-inner {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.quick-actions { display: none; }

.primary-btn, .soft-btn, .ghost-btn, .copy-btn { 
  padding: 12px 20px; font-weight: 700; border-radius: 14px; 
  transition: all 0.2s ease; box-shadow: none;
}
.primary-btn { 
  background: linear-gradient(135deg, var(--accent), var(--accent-strong)); 
  color: var(--bg); border-color: transparent;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.primary-btn:hover { 
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.soft-btn { 
  background: var(--accent-soft); color: var(--accent);
  border-color: rgba(0, 212, 255, 0.2);
}
.soft-btn:hover { 
  background: var(--accent);
  color: var(--bg);
  transform: translateY(-1px);
}

.ghost-btn, .copy-btn { 
  background: var(--panel); color: var(--text);
  border-color: var(--line);
}
.ghost-btn:hover, .copy-btn:hover { 
  border-color: var(--accent); color: var(--accent);
}
.copy-btn.copied { color: var(--good); border-color: var(--good); background: var(--good-soft); }

/* Pill */
.pill {
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 8px 14px;
  background: var(--panel); border: 1px solid var(--line); font-size: 0.875rem; color: var(--text-secondary); font-weight: 600;
}
.pill.ready { background: var(--good-soft); color: var(--good); border-color: rgba(16, 185, 129, 0.3); }
.pill.soon { background: var(--warn-soft); color: var(--warn); border-color: rgba(245, 158, 11, 0.3); }

/* Player */
.player-shell { 
  width: 100%; padding: 24px; margin-top: 8px; 
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
  isolation: isolate;
  position: relative;
}
.player-grid { width: 100%; display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.player-grid.single-column { display: flex; flex-direction: column; width: 100%; }
.player-grid.single-column > * { width: 100%; }
.player-grid.single-column .player-sidebar { order: -1; }
.player-sidebar { display: grid; gap: 16px; }
.player-sidebar-wide { grid-template-columns: minmax(0, 1fr); }

.player-stage {
  width: 100%;
  border-radius: 20px; overflow: hidden; 
  background: #0a0a10; border: 1px solid var(--line); 
  position: relative;
  min-height: 600px;
  z-index: 1;
}
.player-viewport { 
  width: 100%; position: relative; min-height: 600px; height: 600px; 
  background: linear-gradient(180deg, #0a0a14, #050508); 
  z-index: 1;
}
.player-viewport iframe, .player-viewport object, .player-viewport embed { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #050508; }

.player-toolbar { 
  justify-content: space-between; padding: 14px 18px; 
  background: var(--panel-soft); border-top: 1px solid var(--line);
}
.player-toolbar, .player-toolbar-group { min-width: 0; }
.player-toolbar-group:last-child { justify-content: flex-end; }
.player-toolbar-group > .soft-btn, .player-toolbar-group > .ghost-btn, .player-toolbar-group > .primary-btn, .player-toolbar-group > .copy-btn { white-space: normal; }
.toolbar-label { color: var(--muted); font-size: 0.9rem; }

/* Panel */
.panel { padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel h2, .rom-section h2, .system-card h3, .rom-card h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }

/* Form Block */
.form-block { display: grid; gap: 12px; }
.form-label { font-weight: 700; font-size: 0.95rem; color: var(--text); }

/* File Drop */
.file-drop { 
  border: 2px dashed var(--line-strong); border-radius: 20px; 
  background: var(--panel-soft); padding: 28px; display: grid; gap: 12px; 
  text-align: center; transition: all 0.25s ease;
}
.file-drop strong { font-size: 1.05rem; font-weight: 700; color: var(--text); }
.file-drop .helper { color: var(--muted); max-width: 50ch; margin: 0 auto; line-height: 1.5; }
.file-drop.is-dragover { 
  border-color: var(--accent); 
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px var(--accent-soft), 0 10px 40px rgba(0, 0, 0, 0.3);
  transform: scale(1.01);
}
.file-drop:focus-within { border-color: var(--accent); }
.file-drop input[type=file] { display: none; }

/* Split Inline */
.split-inline { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }

/* Notice Inline */
.notice-inline { 
  padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; 
  border: 1px solid var(--line); border-radius: 16px; background: var(--panel);
}
.notice-inline.success { background: var(--good-soft); border-color: rgba(16, 185, 129, 0.3); }
.notice-inline.warning { background: var(--warn-soft); border-color: rgba(245, 158, 11, 0.3); }
.notice-inline.error { background: var(--danger-soft); border-color: rgba(239, 68, 68, 0.3); }

.notice-icon { 
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; 
  font-weight: 900; background: var(--accent-soft); color: var(--accent); flex: 0 0 auto;
}
.notice-inline.success .notice-icon { background: var(--good-soft); color: var(--good); }
.notice-inline.warning .notice-icon { background: var(--warn-soft); color: var(--warn); }
.notice-inline.error .notice-icon { background: var(--danger-soft); color: var(--danger); }

.notice-copy { flex: 1; }
.notice-copy strong { display: block; margin-bottom: 4px; font-weight: 700; }
.notice-copy p { margin: 0; color: var(--text-secondary); }
.notice-dismiss { margin-left: auto; align-self: center; border: 0; background: transparent; color: var(--muted); font-weight: 700; padding: 6px 0; }

/* Player Status */
.player-status { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 12; }

/* Control Grid */
.control-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.control-card { 
  padding: 18px; border: 1px solid var(--line); border-radius: 18px; 
  background: var(--panel); transition: all 0.2s ease;
}
.control-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.control-card strong { display: block; margin-bottom: 6px; font-weight: 700; }
.control-card span { color: var(--muted); font-size: 0.9rem; }

/* System Grid */
.system-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 24px; }
.system-card { 
  padding: 22px; border: 1px solid var(--line); border-radius: 20px; 
  background: var(--panel);
  display: grid; gap: 14px;
  transition: all 0.25s ease;
}
.system-card:hover { 
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent-soft);
}
.system-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.system-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.system-state { font-size: 0.85rem; font-weight: 800; color: var(--good); }
.system-state.soon { color: var(--warn); }

/* ROM Section */
.rom-section { 
  padding: 24px; margin: 28px auto; 
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg);
}
.rom-head { align-items: end; justify-content: space-between; gap: 14px; }
.rom-search { flex: 1 1 340px; }
.rom-count {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
}
.rom-toolbar {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel-soft);
}
.rom-toolbar::before {
  content: 'Quick search';
  width: 100%;
  display: block;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ROM Grid - Responsive Tiles */
.rom-grid { 
  display: grid; 
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); 
  gap: 14px; 
  margin-top: 18px; 
}
.rom-card { 
  border: 1px solid var(--line); border-radius: 16px; padding: 0; 
  background: var(--panel-soft);
  transition: all 0.25s ease;
  cursor: pointer;
  overflow: hidden;
}
.rom-card:hover {
  border-color: var(--accent);
  background: var(--panel);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 20px var(--accent-soft);
}
.rom-card-inner {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.rom-card-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(0, 212, 255, 0.2);
  display: grid; place-items: center;
  color: var(--accent);
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.rom-card-info { flex: 1; min-width: 0; }
.rom-card h3 { 
  margin: 0; font-weight: 700; font-size: 0.9rem; 
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rom-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}
.rom-card-action {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
}
.rom-card-action .soft-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: 0.85rem;
  text-align: center;
}
.rom-url { display: none; }

@media (max-width: 600px) {
  .rom-grid { 
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); 
    gap: 10px; 
  }
  .rom-card-inner { padding: 12px; }
  .rom-card-icon { width: 36px; height: 36px; font-size: 1rem; }
  .rom-card h3 { font-size: 0.85rem; }
}

@media (max-width: 400px) {
  .rom-grid { 
    grid-template-columns: repeat(2, 1fr); 
  }
}

/* Pager */
.pager { justify-content: center; margin-top: 24px; }
.page-link { 
  min-width: 42px; height: 42px; display: inline-grid; place-items: center; 
  font-weight: 700; padding: 0 14px; box-shadow: none; 
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  transition: all 0.2s ease;
}
.page-link:hover { border-color: var(--accent); color: var(--accent); }
.page-link.is-active { background: var(--accent); color: var(--bg); border-color: transparent; }
.page-link.is-disabled { opacity: 0.4; pointer-events: none; }

/* Empty State */
.inline-empty { 
  padding: 32px; border: 1px dashed var(--line-strong); border-radius: 20px; 
  background: var(--panel-soft); color: var(--muted); text-align: center;
}

/* Toast */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 12px; width: min(380px, calc(100vw - 40px)); }
.toast { 
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); 
  border-radius: 14px; box-shadow: var(--shadow-lg); padding: 16px;
}
.toast.success { border-left-color: var(--good); }
.toast.warning { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 4px; font-weight: 700; }
.toast p { margin: 0; color: var(--text-secondary); font-size: 0.925rem; }

/* Fullscreen */


/* Keep interactive emulator UI above surrounding layout blocks */
.site-header,
.page-hero,
.player-shell,
.player-stage,
.player-viewport,
.player-toolbar,
.player-toolbar-group,
.player-sidebar,
.panel,
.file-drop,
.rom-section,
.rom-toolbar,
.rom-grid,
.smart-fullscreen,
.smart-fullscreen .fullscreen-close,
.soft-btn,
.ghost-btn,
.primary-btn,
.copy-btn {
  position: relative;
  isolation: isolate;
}
.site-header { z-index: 400; }
.page-hero,
.player-shell,
.player-stage,
.player-toolbar,
.player-sidebar,
.panel,
.file-drop,
.rom-section,
.rom-toolbar,
.smart-fullscreen,
.smart-fullscreen .fullscreen-close,
.soft-btn,
.ghost-btn,
.primary-btn,
.copy-btn {
  z-index: 40;
}
.player-toolbar,
.smart-fullscreen .fullscreen-close {
  z-index: 60;
}
.player-viewport iframe[data-player-iframe] { z-index: 1; }

.tg-ad-slot {
  width: 100%;
  margin: 18px 0 22px;
}
.tg-ad-slot .container {
  width: min(100% - 32px, var(--container));
  margin-inline: auto;
}
.tg-ad-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  padding: 12px 12px 10px;
  overflow: hidden;
}
.tg-ad-label {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tg-ad-slot--top {
  margin-top: 12px;
}
.tg-ad-slot--player {
  margin: 12px 0 0;
}
.tg-ad-slot--player .container {
  width: 100%;
}
.tg-ad-slot--player .tg-ad-card {
  border-inline: 0;
  border-radius: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 15, 0.92);
}
.tg-ad-slot--footer {
  margin-top: 34px;
  margin-bottom: 24px;
}
.smart-fullscreen .tg-ad-slot--player,
.smart-fullscreen.is-native .tg-ad-slot--player,
.smart-fullscreen.is-pseudo .tg-ad-slot--player,
.smart-fullscreen:fullscreen .tg-ad-slot--player,
.smart-fullscreen:-webkit-full-screen .tg-ad-slot--player,
body.tg-player-fullscreen .tg-ad-slot--top,
body.tg-player-fullscreen .tg-ad-slot--footer {
  display: none !important;
}
.smart-fullscreen { z-index: 200; }
.smart-fullscreen .fullscreen-close {
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  right: env(safe-area-inset-right, 0px);
  z-index: 30;
  width: 54px; height: 54px; min-width: 54px; padding: 0; margin: 0;
  border: 0; border-radius: 0; background: transparent; color: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none; box-shadow: none;
  display: grid; place-items: center; font-size: 0; line-height: 1; text-indent: -9999px; overflow: hidden;
}
.smart-fullscreen .fullscreen-close::before {
  content: '×'; color: #ffffff; font-size: 36px; font-weight: 400; line-height: 1;
  text-indent: 0; text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.smart-fullscreen .fullscreen-close:hover { background: transparent; transform: none; }
.smart-fullscreen.is-native, .smart-fullscreen.is-pseudo { background: #030305; isolation: isolate; }
.smart-fullscreen.is-native, .smart-fullscreen:fullscreen, .smart-fullscreen:-webkit-full-screen { 
  width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; margin: 0; padding: 0; 
  z-index: 200;
}
.smart-fullscreen.is-native .player-toolbar, .smart-fullscreen:fullscreen .player-toolbar, .smart-fullscreen:-webkit-full-screen .player-toolbar,
.smart-fullscreen.is-pseudo .player-toolbar { display: none !important; }
.smart-fullscreen.is-native .player-viewport, .smart-fullscreen:fullscreen .player-viewport, .smart-fullscreen:-webkit-full-screen .player-viewport { 
  width: 100vw; height: 100vh; min-height: 100vh; 
}
.smart-fullscreen.is-native .player-status, .smart-fullscreen:fullscreen .player-status, .smart-fullscreen:-webkit-full-screen .player-status { left: 14px; right: 14px; }
.smart-fullscreen.is-pseudo { position: fixed !important; inset: 0 !important; z-index: 250 !important; padding: 0 !important; margin: 0 !important; border-radius: 0 !important; width: 100vw !important; height: 100vh !important; max-width: none !important; max-height: none !important; }
.smart-fullscreen.is-pseudo .player-viewport { min-height: 100vh; height: 100vh; }
body.has-pseudo-fullscreen { overflow: hidden; }
body.tg-player-fullscreen .site-header, body.tg-player-fullscreen .drawer { display: none !important; }

#game, #flash-player { position: absolute; inset: 0; width: 100%; height: 100%; }
#flash-player > * { width: 100% !important; height: 100% !important; max-width: none !important; }

.flash-seo-schema { display: none; }

/* Policy Page */
.policy-page { padding: 40px 0 60px; }
.policy-shell { 
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); 
  box-shadow: var(--shadow); padding: 32px;
}
.policy-shell h1 { margin: 0 0 12px; font-size: clamp(2rem, 4vw, 2.8rem); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.policy-shell h2 { margin: 32px 0 14px; font-size: 1.3rem; font-weight: 700; }
.policy-shell p, .policy-shell li { color: var(--text-secondary); line-height: 1.75; }
.policy-shell ul { margin: 12px 0 0; padding-left: 20px; }
.policy-meta { margin: 0; color: var(--muted); }
.policy-shell a.external-link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }
.footer a { transition: color 0.2s ease; }
.footer a:hover { color: var(--accent); }

/* ROM Size Warning */
.romsizewarning {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.3);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.925rem;
  line-height: 1.5;
  margin: 8px 10%;
  text-align: center;
}

/* Responsive */
@media (max-width: 1080px) {
  .page-hero-inner { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-sidebar-wide { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .container { width: min(100% - 20px, var(--container)); }
  .page-hero, .hero { padding-top: 28px; }
  .home-two-card, .system-grid, .control-grid { grid-template-columns: 1fr; }
  .header-chip, .brand-subtitle { display: none; }
  .split-inline { grid-template-columns: 1fr; }
  .player-stage { min-height: 600px; height: auto; }
  .rom-head { align-items: flex-start; }
  .rom-count { margin-bottom: 4px; }
  .player-viewport { min-height: 600px; height: 600px; }
  .player-toolbar { align-items: stretch; justify-content: flex-start; gap: 10px; }
  .player-toolbar-group { width: auto; min-width: 0; }
  .player-toolbar-group:first-child { flex: 1 1 100%; }
  .player-toolbar-group:last-child { width: 100%; flex: 1 1 100%; justify-content: flex-start; }
  .player-toolbar-group:last-child > .soft-btn, .player-toolbar-group:last-child > .ghost-btn, .player-toolbar-group:last-child > .primary-btn, .player-toolbar-group:last-child > .copy-btn { flex: 1 1 150px; min-width: 140px; max-width: 100%; }
  .smart-fullscreen.is-native .player-viewport, .smart-fullscreen:fullscreen .player-viewport, .smart-fullscreen:-webkit-full-screen .player-viewport, .smart-fullscreen.is-pseudo .player-viewport { height: 100vh; min-height: 100vh; }
}
