html, body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #111;
  touch-action: none;
  font-family: Arial, sans-serif;
  color: white;
}

/* TITLE SCREEN */
#titleScreen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 20px;
  z-index: 9999;
  pointer-events: auto;
}

#titleScreen.hidden {
  display: none;
  pointer-events: none;
}

#titleScreen h1 {
  font-size: 48px;
  margin-bottom: 10px;
}

#titleScreen .subtitle {
  font-size: 20px;
  opacity: 0.8;
  margin-bottom: 20px;
}

#titleScreen .instructions {
  max-width: 400px;
  text-align: left;
  margin-bottom: 30px;
}

#titleScreen button {
  padding: 16px 26px;
  font-size: 24px;
  margin: 10px;
  border-radius: 12px;
  border: none;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(5px);
  color: white;
}

/* GAME PANEL */
#gamePanel {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 180px);
  display: flex;
  justify-content: center;
  align-items: center;

  background: #222;
  padding: 26px;

  border: 8px solid #444;
  border-radius: 22px;

  box-shadow:
    0 0 40px rgba(0,0,0,0.6) inset,
    0 0 20px rgba(0,0,0,0.5);

  box-sizing: border-box;
}

/* MODE TITLE */
#modeTitle {
  position: absolute;
  top: 8px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 26px;
  font-weight: bold;
  pointer-events: none;
  opacity: 0.9;
}

/* DESIGN MODE BLUE */
#gamePanel.designMode {
  border-color: #3a6aff;
  box-shadow:
    0 0 40px rgba(0,80,255,0.4) inset,
    0 0 20px rgba(0,80,255,0.4);
}

/* PLAY MODE GREEN */
#gamePanel.playMode {
  border-color: #3aff6a;
  box-shadow:
    0 0 40px rgba(0,255,80,0.4) inset,
    0 0 20px rgba(0,255,80,0.4);
}

/* ADMIN MODE RED */
#gamePanel.adminMode {
  border-color: #ff3a3a;
  box-shadow:
    0 0 40px rgba(255,80,80,0.4) inset,
    0 0 20px rgba(255,80,80,0.4);
}

/* CANVAS */
#game {
  position: relative;
  border-radius: 14px;
  box-shadow: 0 0 25px rgba(0,0,0,0.5);
}

/* CONTROL BAR */
#controlBar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px 0;

  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(12px);
}

/* ROWS */
.row1 {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}

.row2 {
  display: flex;
  justify-content: center;
  gap: 32px;
}

/* BUTTONS */
button {
  padding: 10px 18px;
  font-size: 18px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  color: white;
  backdrop-filter: blur(5px);
  cursor: pointer;
}

button:active {
  background: rgba(255,255,255,0.3);
}

/* SOLVE / SOLUTION BUTTON */
#solveBtn {
  background: rgba(0, 180, 255, 0.25);
  border: none;
}

#solveBtn:active {
  background: rgba(0, 180, 255, 0.4);
}

/* HUD */
#hud {
  text-align: center;
  font-size: 20px;
  margin-top: 6px;
}

/* OVERLAY (solution / success / seed / admin login) */
.overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  max-width: 420px;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 16px;
  text-align: center;
  z-index: 10000;
  box-shadow: 0 0 25px rgba(0,0,0,0.7);
}

.overlay h2 {
  margin-top: 0;
  margin-bottom: 12px;
}

.overlay p {
  margin-bottom: 12px;
}

.overlay input {
  width: 80%;
  padding: 8px;
  margin: 10px 0;
  border-radius: 8px;
  border: none;
  font-size: 16px;
}

.overlay-buttons {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hidden {
  display: none;
}
/* ========================= */
/*   FULLSCREEN ADMIN PANEL  */
/* ========================= */

#adminPanel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #111;
  color: #fff;
  display: grid;
  grid-template-columns: 260px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "left middle"
    "left middle"
    "export export";
  gap: 16px;
  padding: 16px;
  box-sizing: border-box;
  z-index: 10000;
}

/* reuse your existing .hidden class:
.hidden { display: none; } */

.admin-left {
  grid-area: left;
  background: #1b1b1b;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  overflow-y: auto;
}

.admin-middle {
  grid-area: middle;
  background: #1b1b1b;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-bottom {
  grid-area: export;
  background: #1b1b1b;
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* EXIT ADMIN BUTTON */

.admin-exit-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 8px;
  border: none;
  background: rgba(255,80,80,0.3);
  color: #fff;
  cursor: pointer;
}

.admin-exit-btn:hover {
  background: rgba(255,80,80,0.5);
}

/* LEVEL LIST */

#adminLevelList h2,
#adminLevelEditor h2,
#adminExport h2 {
  margin: 0 0 8px 0;
  font-size: 18px;
}

#adminLevelsContainer {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

#adminLevelsContainer button {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
}

#adminLevelsContainer button:hover {
  background: rgba(255,255,255,0.18);
}

.admin-add-btn {
  width: 100%;
  padding: 8px;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  background: rgba(0,180,255,0.3);
  color: #fff;
  cursor: pointer;
}

.admin-add-btn:hover {
  background: rgba(0,180,255,0.5);
}

/* INPUTS */

.admin-input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: none;
  font-size: 14px;
  margin-bottom: 8px;
  box-sizing: border-box;
}

/* TOOLBAR */

#adminTools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.toolBtn {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
}

.toolBtn.active {
  background: rgba(0,180,255,0.6);
}

.toolBtn:hover {
  background: rgba(255,255,255,0.2);
}

/* BOARD GRID (5x5) */

#adminBoardGrid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 4px;
  margin-top: 4px;
  margin-bottom: 10px;
}

.admin-cell {
  width: 100%;
  padding-top: 100%; /* square */
  position: relative;
  border-radius: 6px;
  background: #333;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(0,0,0,0.6) inset;
}

.admin-cell-inner {
  position: absolute;
  inset: 4px;
  border-radius: 4px;
}

/* cell states */

.admin-cell-inner.empty {
  background: #333;
}

.admin-cell-inner.grey {
  background: #777;
}

.admin-cell-inner.hole {
  background: #000;
  box-shadow: 0 0 10px rgba(0,0,0,0.9) inset;
}

.admin-cell-inner.disc::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #00ff80;
  box-shadow: 0 0 10px rgba(0,255,128,0.8);
}

/* ACTION BUTTONS */

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-actions button {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  background: rgba(255,255,255,0.12);
  color: #fff;
  cursor: pointer;
}

.admin-actions button:hover {
  background: rgba(255,255,255,0.22);
}

.admin-actions .danger {
  background: rgba(255,80,80,0.4);
}

.admin-actions .danger:hover {
  background: rgba(255,80,80,0.6);
}

/* EXPORT AREA */

#adminRawOutput {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  border: none;
  padding: 8px;
  font-size: 12px;
  font-family: monospace;
  box-sizing: border-box;
  background: #111;
  color: #0f0;
}

#adminExportBtn {
  align-self: flex-start;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: none;
  background: rgba(0,180,255,0.4);
  color: #fff;
  cursor: pointer;
}

#adminExportBtn:hover {
  background: rgba(0,180,255,0.6);
}
#adminPanel.hidden {
  display: none !important;
}

/* RESPONSIVE TWEAKS */

@media (max-width: 800px) {
  #adminPanel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "left"
      "middle"
      "export";
  }

  .admin-left {
    max-height: 180px;
  }
}
