*,
*::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;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

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

#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 0.35s ease;
  z-index: 10;
  opacity: 0.4;
}

#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 0.15s,
    background 0.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: 0.62rem;
  letter-spacing: 0.08em;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
}

#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: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.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: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

: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;
}
.card-cover {
  background: var(--dim);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.card-cover.no-image {
  background: linear-gradient(135deg, var(--dim), rgba(255, 255, 255, 0.05));
}

.card-cover.no-image::after {
  content: "x";
  font-size: 2rem;
  opacity: 0.4;
}
#search-container {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 999;
}
#search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);

  padding: 8px 12px;
  border-radius: 8px;

  width: 220px;
  font-size: 14px;

  outline: none;

  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}
#search-bar::placeholder {
  color: var(--muted);
}
#search-bar:focus {
  border-color: var(--border-hi);
  background: var(--raised);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.04);
}
.card-name {
  font-family: "Syne", sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.card-footer {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  width: 100%;
  overflow: hidden;
}

.card-footer span {
  font-family: "Syne", sans-serif;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: block;
}

.card-footer a {
  font-size: 0.65rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  display: block;
}

.card-footer a:visited {
  color: var(--muted);
}

.card-footer a:hover {
  color: var(--text);
}
#lock-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

#lock-box {
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#lock-title {
  font-family: "Syne", sans-serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-align: center;
  color: var(--muted);
}

#lock-input {
  background: var(--raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 6px;
  outline: none;
  text-align: center;
  font-family: "DM Mono", monospace;
}

#lock-input:focus {
  border-color: var(--border-hi);
  background: var(--dim);
}

#lock-error {
  font-size: 0.6rem;
  text-align: center;
  color: #ff4d4d;
  height: 10px;
  opacity: 0.8;
}
#actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

#searchInput {
  height: 36px;
  width: 320px;
  padding: 0 12px;

  border-radius: 7px;
  background: var(--raised);
  border: 1px solid var(--border-hi);

  color: var(--text);
  font-family: "DM Mono", monospace;
  font-size: 0.7rem;

  outline: none;

  transition: all 0.15s ease;
}

#searchInput::placeholder {
  color: var(--muted);
}

#searchInput:focus {
  border-color: var(--border-hi);
  background: var(--dim);
}

#searchBtn {
  height: 36px;
  padding: 0 16px;

  border-radius: 7px;
  background: var(--raised);
  border: 1px solid var(--border-hi);

  color: var(--text);
  font-family: "Syne", sans-serif;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;

  cursor: pointer;

  transition: all 0.15s ease;
}

#searchBtn:hover {
  background: var(--dim);
  border-color: var(--border-hi);
}
