:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111722;
  color: #f4f6fb;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 320px; }

button { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  background: #151b27;
  border-right: 1px solid #2b3342;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: #fff;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(135deg, #eabd67, #dd7d67);
  color: #202333;
  font-size: 1.05rem;
}

.eyebrow {
  margin: 34px 10px 10px;
  color: #8590a6;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.game-list { display: grid; gap: 6px; }

.game-tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #c8cfdd;
  cursor: pointer;
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.game-tab:hover { background: #202938; color: #fff; }
.game-tab:active { transform: scale(0.98); }
.game-tab:focus-visible, .restart-button:focus-visible { outline: 3px solid #85b8ff; outline-offset: 2px; }

.game-tab.is-active {
  border-color: #46536a;
  background: #273144;
  color: #fff;
}

.game-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  font-size: 1.2rem;
}

.puzzle { background: #665358; }
.rondo { background: #29636c; }

.game-copy { display: grid; gap: 2px; min-width: 0; }
.game-name { font-size: 0.92rem; font-weight: 750; }
.game-description { color: #94a0b7; font-size: 0.75rem; }
.is-active .game-description { color: #c2cad9; }

.sidebar-note {
  margin: auto 10px 0;
  color: #69758b;
  font-size: 0.77rem;
  line-height: 1.5;
}

.game-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  background: #0d121b;
}

.game-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 14px clamp(20px, 3vw, 42px);
  border-bottom: 1px solid #283142;
  background: #151b27;
}

.game-toolbar .eyebrow { margin: 0 0 4px; }

h1 {
  margin: 0;
  font-size: clamp(1.05rem, 1.7vw, 1.35rem);
  letter-spacing: -0.03em;
}

.restart-button {
  padding: 9px 13px;
  border: 1px solid #3d485b;
  border-radius: 9px;
  background: #202938;
  color: #e2e7f1;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.restart-button:hover { border-color: #61718b; background: #2b374b; color: #fff; }

.game-frame-wrap { min-height: 0; padding: clamp(10px, 1.8vw, 24px); }

#game-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 40px rgb(0 0 0 / 0.22);
}

@media (max-width: 680px) {
  .app-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .sidebar { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 12px 14px; border-right: 0; border-bottom: 1px solid #2b3342; }
  .brand { padding: 0; white-space: nowrap; }
  .sidebar > .eyebrow, .sidebar-note { display: none; }
  .game-list { display: flex; justify-content: flex-end; gap: 5px; }
  .game-tab { width: auto; padding: 5px; border-radius: 9px; }
  .game-icon { width: 32px; height: 32px; font-size: 1rem; }
  .game-copy { display: none; }
  .game-toolbar { min-height: 65px; padding: 10px 16px; }
  .game-frame-wrap { padding: 0; }
  #game-frame { border-radius: 0; box-shadow: none; }
}
