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

:root {
  --bg:        #0a0a0a;
  --surface:   #111111;
  --raised:    #181818;
  --border:    #1e1e1e;
  --border-hi: #2e2e2e;
  --text:      #d8d8d8;
  --muted:     #484848;
  --dim:       #242424;
  --toolbar:   54px;
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Mono', monospace;
}

/* ── LAYOUT ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#main {
  flex: 1;
  display: flex;
  gap: 8px;
  padding: 8px 8px 0 8px;
  overflow: hidden;
}

/* ── FRAME ── */
#frame-outer {
  flex: 1;
  position: relative;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: #000;
}

#game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

#load-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
  z-index: 10;
  opacity: .4;
}

/* ── CONTROLS (right column) ── */
#controls {
  width: 42px;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface);
}

.ctrl-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  position: relative;
}

.ctrl-btn + .ctrl-btn {
  border-top: 1px solid var(--border);
}

.ctrl-btn:hover {
  background: var(--raised);
  color: var(--text);
}

.ctrl-btn:active {
  background: var(--dim);
}

.ctrl-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ctrl-btn[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--raised);
  border: 1px solid var(--border-hi);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: .62rem;
  letter-spacing: .08em;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

/* ── TOOLBAR ── */
#toolbar {
  height: var(--toolbar);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

.tb-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: 'Syne', sans-serif;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.tb-btn:hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.tb-btn.active {
  background: var(--raised);
  border-color: var(--border-hi);
  color: var(--text);
}

#tb-label {
  flex: 1;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: .65rem;
  color: var(--muted);
  letter-spacing: .14em;
  text-transform: uppercase;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* fullscreen: hide chrome */
:fullscreen #toolbar    { display: none !important; }
:fullscreen #main       { padding: 0; gap: 0; }
:fullscreen #controls   { display: none; }
:fullscreen #frame-outer { border-radius: 0; border: none; }
:-webkit-full-screen #toolbar  { display: none !important; }
:-webkit-full-screen #main     { padding: 0; gap: 0; }
:-webkit-full-screen #controls { display: none; }
