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

/* ---- Device overlay ---- */
#device-overlay {
  position: fixed; inset: 0; z-index: 99999;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 100%);
  display: flex; align-items: center; justify-content: center;
}
.device-box {
  text-align: center; padding: 40px;
  max-width: 400px; width: 90%;
}
.device-icon { font-size: 64px; color: #0cf; margin-bottom: 10px; }
.device-title { font-size: 32px; font-weight: 700; color: #0cf; margin-bottom: 6px; }
.device-subtitle { font-size: 14px; color: #888; margin-bottom: 30px; }
.device-buttons { display: flex; flex-direction: column; gap: 12px; }
.device-btn {
  padding: 16px 24px; font-size: 18px; font-weight: 600;
  border: 2px solid #2a3a5a; border-radius: 12px;
  background: rgba(255,255,255,0.05); color: #eee;
  cursor: pointer; transition: all 0.2s;
}
.device-btn:hover { border-color: #0cf; background: rgba(12,204,255,0.1); }

/* ---- Orientation overlay ---- */
#orientation-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: #0a0a1a; display: flex;
  align-items: center; justify-content: center;
}
.orientation-box { text-align: center; padding: 40px; }
.orientation-icon { font-size: 80px; margin-bottom: 20px; animation: rotate-phone 2s ease-in-out infinite; }
.orientation-text { font-size: 22px; font-weight: 600; color: #0cf; margin-bottom: 10px; }
.orientation-sub { font-size: 14px; color: #888; }
@keyframes rotate-phone {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(90deg); }
}

/* ---- Phone mode (16:9 paysage) ---- */
body.phone-mode #device-overlay { display: none; }
body.phone-mode {
  background: #000;
  display: flex; align-items: center; justify-content: center;
}
body.phone-mode #app {
  width: 100vw; height: 56.25vw;
  max-height: 100vh; max-width: 177.78vh;
  position: relative; overflow: hidden;
}
body.phone-mode #sidebar {
  width: 140px; padding: 12px 8px;
}
body.phone-mode #sidebar .logo-text { font-size: 14px; }
body.phone-mode #sidebar .nav-btn {
  font-size: 12px; padding: 8px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.phone-mode #launcher {
  height: 100%; flex: 1; overflow-y: auto;
}
body.phone-mode .game-container {
  height: 100% !important;
}
body.phone-mode #user-sidebar {
  font-size: 11px; padding: 8px;
}

/* Scrollbar foncée */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #2a3a5a; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a4a6a; }

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: #2a3a5a #1a1a2e; }

:root {
  --bg: #1a1a2e;
  --surface: #16213e;
  --surface2: #0f3460;
  --accent: #e94560;
  --accent2: #533483;
  --text: #eee;
  --text2: #aaa;
  --card-bg: #1e2a4a;
  --card-border: #2a3a5a;
  --shadow: rgba(0,0,0,0.4);
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

#app { height: 100vh; display: flex; }

.screen { display: none; }
.screen.active { display: flex; }

/* ---- Launcher ---- */
#launcher {
  flex: 1;
  height: 100vh;
}

#sidebar {
  width: 220px;
  background: var(--surface);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--card-border);
  position: relative;
  z-index: 1;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  padding: 0 8px;
}

.logo-icon {
  font-size: 28px;
  color: var(--accent);
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.logo-lite {
  font-size: 12px;
  background: var(--accent);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-server {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--card-border);
}

.sidebar-servers {
  margin-top: 4px;
}

.servers-btn { color: #ff9800 !important; }
.servers-btn:hover { background: #ff980022 !important; color: #ffb74d !important; }

#server-browser-panel {
  background: #111827;
  border: 1px solid #2a3a5a;
  border-radius: 8px;
  margin-top: 4px;
  padding: 8px;
  font-size: 12px;
}
#sb-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid #2a3a5a;
  color: #ccc; font-weight: 600;
}
#sb-list { max-height: 200px; overflow-y: auto; }
.sb-empty { color: #666; text-align: center; padding: 12px 0; font-size: 11px; }
.sb-room {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 6px; border-radius: 4px; margin-bottom: 2px; cursor: pointer;
}
.sb-room:hover { background: #1e2a4a; }
.sb-room-info { display: flex; gap: 6px; align-items: center; }
.sb-room-game { color: #4fc3f7; font-weight: 600; font-size: 11px; }
.sb-room-players { color: #888; font-size: 10px; }
.sb-room-join { background: #4CAF50; color: #fff; border: none; padding: 2px 8px; border-radius: 4px; font-size: 10px; cursor: pointer; }
.sb-room-join:hover { background: #66bb6a; }
#sb-footer { margin-top: 4px; text-align: center; }

.sidebar-admin {
  margin-top: 4px;
}

.admin-btn { color: #e94560 !important; }
.admin-btn:hover { background: #e9456022 !important; color: #ff6666 !important; }

.game-card.admin-mode { outline: 2px solid #e94560; }
.game-card .btn-edit { display:none; }
.admin-mode .game-card .btn-edit { display:block; position:absolute; top:8px; left:8px; background:#e94560; color:#fff; border:none; padding:2px 8px; border-radius:4px; font-size:10px; cursor:pointer; z-index:2; }

.server-btn { color: #4CAF50 !important; }
.server-btn:hover { background: #4CAF5022 !important; color: #66ff66 !important; }

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text2);
  padding: 10px 12px;
  text-align: left;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent2); color: #fff; font-weight: 600; }

.sidebar-chat {
  margin-top: 4px;
}

.user-btn { color: #4fc3f7 !important; }
.user-btn:hover { background: #4fc3f722 !important; color: #81d4fa !important; }

/* ---- Login Overlay ---- */
#login-overlay {
  position: fixed; inset: 0; z-index: 2000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
}

#login-box {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px 32px;
  min-width: 340px;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#login-tabs {
  display: flex; gap: 4px;
  background: var(--surface2); border-radius: 8px; padding: 3px;
}

.login-tab {
  background: transparent; border: none; color: var(--text2);
  padding: 6px 18px; border-radius: 6px; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: all 0.15s;
}
.login-tab.active { background: var(--accent); color: #fff; }

#login-fields { width: 100%; }
.login-field-group {
  display: flex; flex-direction: column; gap: 10px; width: 100%;
}

.login-field-group input {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 8px; padding: 10px 14px;
  color: #fff; font-size: 14px; outline: none; width: 100%;
}
.login-field-group input:focus { border-color: #4fc3f7; }

.login-submit {
  background: #4fc3f7; color: #fff; border: none;
  padding: 10px 0; border-radius: 8px;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.login-submit:hover { background: #29b6f6; }

.login-error {
  color: #e94560; font-size: 12px; text-align: center; min-height: 18px;
}

/* ---- Chat Overlay ---- */
#game-chat-btn {
  background: transparent; border: none;
  color: var(--text2); font-size: 20px; cursor: pointer;
  width: 36px; height: 36px; border-radius: 8px; transition: all 0.15s;
}
#game-chat-btn:hover { background: var(--surface2); color: var(--text); }

#game-chat-overlay {
  position: absolute;
  bottom: 10px; right: 10px;
  width: 260px; height: 160px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  display: flex; flex-direction: column;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  overflow: hidden;
}

#game-chat-messages {
  flex: 1; overflow-y: auto;
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: 3px;
}

.game-chat-msg {
  background: #3a3a3a;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.3;
}

.game-chat-msg .game-chat-author {
  color: #4fc3f7; font-weight: 600; font-size: 10px; margin-right: 4px;
}
.game-chat-msg .game-chat-text { color: #ddd; }
.game-chat-msg .game-chat-time {
  font-size: 9px; color: #888; float: right; margin-left: 6px;
}

#game-chat-input-row {
  display: flex; gap: 4px;
  padding: 4px 6px;
  border-top: 1px solid #444;
  background: #222;
}

#game-chat-input {
  flex: 1;
  background: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 6px;
  color: #fff;
  font-size: 11px;
  outline: none;
}
#game-chat-input:focus { border-color: #4fc3f7; }
#game-chat-input:disabled { opacity: 0.4; }

#game-chat-send {
  background: #4fc3f7;
  border: none; color: #fff;
  width: 30px; border-radius: 4px;
  font-size: 12px; cursor: pointer;
}
#game-chat-send:hover { background: #29b6f6; }
#game-chat-send:disabled { opacity: 0.3; cursor: default; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-players {
  margin-top: 4px;
}

.players-btn { color: #ff9800 !important; }
.players-btn:hover { background: #ff980022 !important; color: #ffb74d !important; }

.sidebar-admin-page {
  margin-top: 2px;
}

.admin-page-btn { color: #ab47bc !important; }
.admin-page-btn:hover { background: #ab47bc22 !important; color: #ce93d8 !important; }

#player-manager td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--card-border);
}

.pm-del-btn {
  background: #e94560; color: #fff; border: none;
  padding: 4px 14px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.pm-del-btn:hover { background: #ff6b81; }

.sidebar-games { margin-top: 2px; }
.games-page-btn { color: #4fc3f7 !important; }
.games-page-btn:hover { background: #4fc3f722 !important; color: #81d4fa !important; }

.sidebar-studio { margin-top: 2px; }
.studio-btn { color: #ffd54f !important; }
.studio-btn:hover { background: #ffd54f22 !important; color: #ffe082 !important; }

.sidebar-pass { margin-top: 2px; }
.pass-btn { color: #ffd700 !important; }
.pass-btn:hover { background: #ffd70022 !important; color: #ffe44d !important; }

.sidebar-skins { margin-top: 2px; }
.skin-btn { color: #ff69b4 !important; }
.skin-btn:hover { background: #ff69b422 !important; color: #ff99cc !important; }

.sidebar-footer {
  padding: 12px 8px 0;
  font-size: 11px;
  color: var(--text2);
  border-top: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

#main-content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

#main-content header h1 {
  font-size: 28px;
  margin-bottom: 20px;
}

#game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px var(--shadow);
}

.game-thumb {
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  position: relative;
}

.game-card .tag {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tag-2d { background: #2d6a4f; color: #d8f3dc; }
.tag-3d { background: #3a5a8c; color: #caf0f8; }

.game-info {
  padding: 12px;
}

.game-info h3 {
  font-size: 14px;
  margin-bottom: 4px;
}

.game-info p {
  font-size: 12px;
  color: var(--text2);
}

/* ---- Game Screen ---- */
#game-screen {
  flex-direction: column;
  flex: 1;
}

#game-header {
  height: 48px;
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid var(--card-border);
}

#back-btn {
  background: var(--surface2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}

#back-btn:hover { background: var(--accent); }

#game-title {
  font-size: 16px;
  font-weight: 600;
}

#game-container {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#game-container canvas {
  display: block;
}

.game-hud {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

.game-hud span { background: rgba(0,0,0,0.5); padding: 4px 12px; border-radius: 6px; }

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  gap: 16px;
}

.game-overlay h2 {
  font-size: 36px;
  color: var(--accent);
}

.game-overlay p {
  font-size: 18px;
}

.game-overlay button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 28px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.game-overlay button:hover { transform: scale(1.05); }

.controls-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.5);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--text2);
  pointer-events: none;
}

/* ---- Marketplace ---- */

/* Avatar portrait in 2D games */
/* ---- Multiplayer ---- */
.tag-multi {
  background: #ff8800;
  color: #fff;
  top: 8px;
  left: 8px;
  right: auto;
  font-size: 9px;
}

.tag-alpha {
  background: #e94560;
  color: #fff;
  top: 8px;
  right: 8px;
  font-size: 9px;
}

.tag-dev {
  background: #8e44ad;
  color: #fff;
  top: 8px;
  right: 8px;
  font-size: 9px;
}

.game-actions {
  display: flex;
  gap: 6px;
  padding: 8px 12px 12px;
}

.btn-play, .btn-multi {
  flex: 1;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-play { background: var(--accent); color: #fff; }
.btn-multi { background: #4CAF50; color: #fff; }
.btn-play:hover, .btn-multi:hover { transform: scale(1.04); }

/* Multiplayer Lobby */
#mp-lobby {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

#mp-lobby-bg {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.65);
}

#mp-lobby-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 28px 32px;
  min-width: 380px;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

#mp-lobby-box h2 { font-size: 20px; }

#mp-lobby-tabs { display: flex; gap: 4px; background: var(--surface2); border-radius: 8px; padding: 3px; }

.mp-lobby-tab {
  background: transparent; border: none; color: var(--text2);
  padding: 6px 18px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.15s;
}

.mp-lobby-tab.active { background: var(--accent); color: #fff; }

#mp-lobby-create, #mp-lobby-join {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

#mp-lobby-create p { font-size: 13px; color: var(--text2); text-align: center; }

.mp-btn-primary {
  background: #4CAF50; color: #fff; border: none;
  padding: 10px 28px; border-radius: 8px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: transform 0.1s;
}

.mp-btn-primary:hover { transform: scale(1.05); }

#mp-room-input {
  width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--card-border);
  background: var(--card-bg); color: #fff; font-size: 16px; text-align: center;
  letter-spacing: 3px; text-transform: uppercase;
}

#mp-room-input::placeholder { letter-spacing: 0; text-transform: none; color: var(--text2); }

#mp-room-list {
  width: 100%; max-height: 120px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
}

.mp-room-entry {
  background: var(--card-bg); padding: 8px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer; border: 1px solid transparent; transition: border-color 0.15s;
}

.mp-room-entry:hover { border-color: var(--accent); }

#mp-lobby-status { font-size: 13px; color: var(--accent); min-height: 20px; }

#mp-lobby-close {
  background: var(--surface2); color: #fff; border: none;
  padding: 8px 24px; border-radius: 8px; font-size: 13px; cursor: pointer;
}

/* ---- Server Hub ---- */
#server-hub {
  display: flex; flex-direction: column;
  height: 100%; padding: 20px 24px;
  color: var(--text); overflow: hidden;
}

.sh-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}

.sh-title-row { display: flex; align-items: center; gap: 10px; }
.sh-title-row h2 { font-size: 22px; }
.sh-icon { font-size: 26px; }

.sh-connection { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.sh-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.sh-dot.green { background: #4CAF50; box-shadow: 0 0 8px #4CAF5066; }
.sh-dot.red { background: #e94560; box-shadow: 0 0 8px #e9456066; }
.sh-sep { color: var(--card-border); }
.sh-url { color: var(--text2); font-family: monospace; font-size: 12px; }

.sh-body { display: flex; gap: 16px; flex: 1; overflow: hidden; }
.sh-main { flex: 1; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.sh-sidebar { width: 340px; display: flex; flex-direction: column; }

.sh-card {
  background: var(--card-bg); border: 1px solid var(--card-border);
  border-radius: 10px; padding: 14px 16px;
}

.sh-card h3 { font-size: 14px; margin-bottom: 10px; color: var(--text); }

.sh-btn-row { display: flex; gap: 8px; }
.sh-btn {
  border: none; padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform 0.1s;
}
.sh-btn:hover { transform: scale(1.04); }
.sh-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.sh-btn-green { background: #4CAF50; color: #fff; }
.sh-btn-red { background: #e94560; color: #fff; }
.sh-btn-blue { background: var(--surface2); color: #fff; }
.sh-btn-accent { background: var(--accent); color: #fff; }

.sh-hint { font-size: 11px; color: var(--text2); margin-top: 8px; }
.sh-hint code { background: var(--surface); padding: 1px 6px; border-radius: 4px; font-size: 11px; }

.sh-form-row { display: flex; gap: 8px; align-items: center; }
.sh-form-row select {
  background: var(--surface); color: #fff; border: 1px solid var(--card-border);
  padding: 8px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
}

.sh-code-row { display: flex; gap: 8px; }
.sh-code-row input {
  flex: 1; background: var(--surface); color: var(--accent);
  border: 1px solid var(--card-border); border-radius: 8px;
  padding: 10px 14px; font-size: 18px; letter-spacing: 4px;
  text-align: center; font-weight: 700; cursor: pointer;
}

.sh-empty { font-size: 12px; color: var(--text2); padding: 8px 0; }

.sh-room-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent; transition: border-color 0.15s;
}
.sh-room-item:hover { border-color: var(--accent); }

.sh-room-info { display: flex; flex-direction: column; gap: 2px; }
.sh-room-id { font-size: 13px; font-family: monospace; letter-spacing: 2px; }
.sh-room-game { font-size: 11px; color: var(--text2); }

.sh-room-players { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sh-player-bar { width: 50px; height: 6px; background: var(--surface); border-radius: 3px; overflow: hidden; }
.sh-player-fill { height: 100%; background: #4CAF50; border-radius: 3px; transition: width 0.3s; }

.sh-log-card { flex: 1; display: flex; flex-direction: column; }
.sh-log {
  flex: 1; font-family: monospace; font-size: 11px; color: var(--text2);
  overflow-y: auto; line-height: 1.6;
  max-height: 400px;
}
.sh-log div { padding: 1px 0; border-bottom: 1px solid var(--card-border); }

/* === Studio === */
#studio-overlay { display:none; position:fixed; inset:0; z-index:9999; }
#studio-bg { position:absolute; inset:0; background:rgba(0,0,0,0.6); }
#studio-panel { position:absolute; inset:12px; background:#0d0d1a; border:1px solid #2a2a4a; border-radius:10px; display:flex; flex-direction:column; overflow:hidden; }
#studio-header { display:flex; justify-content:space-between; align-items:center; padding:8px 14px; background:#13132a; border-bottom:1px solid #2a2a4a; }
#studio-title { font-size:14px; font-weight:600; color:#ffd54f; }
#studio-header-actions { display:flex; gap:6px; }
#studio-header-actions button { padding:5px 12px; border:none; border-radius:4px; font-size:12px; cursor:pointer; font-weight:600; }
#studio-run { background:#2ecc71; color:#fff; }
#studio-run:hover { background:#27ae60; }
#studio-publish { background:#f39c12; color:#fff; }
#studio-publish:hover { background:#e67e22; }
#studio-save { background:#3498db; color:#fff; }
#studio-save:hover { background:#2980b9; }
#studio-close { background:#555; color:#fff; }
#studio-close:hover { background:#777; }
#studio-body { flex:1; display:flex; overflow:hidden; }
#studio-sidebar { width:260px; background:#0d0d1a; border-right:1px solid #2a2a4a; display:flex; flex-direction:column; }
#studio-toolbox-header { padding:8px; border-bottom:1px solid #2a2a4a; }
#studio-search { width:100%; padding:6px 8px; border:1px solid #2a2a4a; border-radius:4px; background:#1a1a3a; color:#eee; font-size:12px; outline:none; }
#studio-search:focus { border-color:#4fc3f7; }
#studio-categories { display:flex; gap:4px; margin-top:6px; flex-wrap:wrap; }
.st-cat { padding:3px 8px; border:1px solid #2a2a4a; border-radius:4px; background:transparent; color:#888; font-size:10px; cursor:pointer; transition:all 0.15s; }
.st-cat:hover { border-color:#555; color:#ddd; }
.st-cat.active { background:#4fc3f7; border-color:#4fc3f7; color:#fff; }
#studio-toolbox-list { flex:1; overflow-y:auto; padding:4px; display:flex; flex-wrap:wrap; align-content:flex-start; gap:3px; }
.st-item { width:calc(50% - 2px); padding:6px 4px; border-radius:4px; cursor:pointer; font-size:9px; text-align:center; transition:transform 0.1s, opacity 0.1s; display:flex; flex-direction:column; gap:1px; }
.st-item:hover { transform:scale(1.05); opacity:0.85; outline:2px solid #fff; }
.st-item-label { font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.st-item-shape { opacity:0.7; font-size:8px; }
#studio-viewport { flex:1; position:relative; cursor:grab; }
#studio-viewport:active { cursor:grabbing; }
#studio-props { width:240px; background:#0d0d1a; border-left:1px solid #2a2a4a; display:flex; flex-direction:column; }
#studio-props-header { padding:8px 12px; font-size:12px; font-weight:600; color:#aaa; border-bottom:1px solid #2a2a4a; }
#studio-props-content { flex:1; overflow-y:auto; }
#studio-props-fields { padding:8px 12px; }
.sp-section { margin-bottom:10px; }
.sp-title { font-size:10px; color:#666; text-transform:uppercase; letter-spacing:0.5px; margin-bottom:4px; }
.sp-row { display:flex; align-items:center; gap:6px; margin-bottom:3px; }
.sp-row label { width:16px; font-size:10px; color:#888; text-align:right; }
.sp-row input[type="number"] { flex:1; padding:3px 6px; border:1px solid #2a2a4a; border-radius:3px; background:#1a1a3a; color:#eee; font-size:11px; outline:none; }
.sp-row input[type="number"]:focus { border-color:#4fc3f7; }
.sp-row input[type="range"] { flex:1; }
#sp-colors { display:flex; flex-wrap:wrap; gap:3px; }
.sp-color { width:22px; height:22px; border:2px solid transparent; border-radius:3px; cursor:pointer; transition:border-color 0.1s; }
.sp-color:hover { border-color:#fff; }
.sp-color.active { border-color:#4fc3f7; outline:1px solid #4fc3f7; }
#sp-material { width:100%; padding:4px 6px; border:1px solid #2a2a4a; border-radius:3px; background:#1a1a3a; color:#eee; font-size:11px; outline:none; }
#sp-material:focus { border-color:#4fc3f7; }

#studio-right { width:260px; background:#0d0d1a; border-left:1px solid #2a2a4a; display:flex; flex-direction:column; }
#studio-right-tabs { display:flex; border-bottom:1px solid #2a2a4a; }
.sr-tab { flex:1; padding:8px; border:none; background:transparent; color:#888; font-size:11px; cursor:pointer; transition:all 0.15s; font-weight:600; }
.sr-tab:hover { color:#ddd; background:rgba(255,255,255,0.03); }
.sr-tab.active { color:#4fc3f7; border-bottom:2px solid #4fc3f7; background:rgba(79,195,247,0.05); }
.sr-panel { flex:1; display:block; overflow-y:auto; }

/* Transform bar */
#studio-transform-bar { display:flex; align-items:center; gap:4px; padding:6px 12px; background:#0d0d1a; border-bottom:1px solid #2a2a4a; }
.st-mode { padding:4px 10px; border:1px solid #2a2a4a; border-radius:4px; background:transparent; color:#888; font-size:11px; cursor:pointer; font-weight:600; transition:all 0.15s; }
.st-mode:hover { border-color:#555; color:#ddd; }
.st-mode.active { background:#4fc3f7; border-color:#4fc3f7; color:#fff; }

/* Code Editor */
#studio-code { flex:1; display:flex; flex-direction:column; overflow:hidden; }
#studio-code-toolbar { display:flex; align-items:center; gap:4px; padding:6px 10px; border-bottom:1px solid #2a2a4a; }
#studio-code-select { flex:1; padding:4px 6px; border:1px solid #2a2a4a; border-radius:3px; background:#1a1a3a; color:#eee; font-size:11px; outline:none; cursor:pointer; }
#studio-code-add, #studio-code-del { padding:3px 8px; border:1px solid #2a2a4a; border-radius:3px; background:transparent; color:#888; font-size:12px; cursor:pointer; }
#studio-code-add:hover, #studio-code-del:hover { border-color:#555; color:#ddd; }
#studio-code-editor { flex:1; width:100%; padding:10px; font-family:'Courier New',monospace; font-size:12px; background:#0a0a12; color:#8f8; border:none; outline:none; resize:none; tab-size:2; white-space:pre; overflow-wrap:normal; overflow-x:auto; }
#studio-code-output { padding:6px 10px; background:#0a0a12; border-top:1px solid #2a2a4a; font-family:monospace; font-size:11px; color:#aaa; max-height:80px; overflow-y:auto; white-space:pre-wrap; }

/* Shop */
.shop-item { display:flex; align-items:center; gap:12px; background:#1e2a4a; border:1px solid #2a3a5a; border-radius:10px; padding:12px 14px; }
.shop-item-icon { font-size:28px; width:40px; text-align:center; }
.shop-item-info { flex:1; }
.shop-item-info h4 { margin:0; font-size:14px; color:#fff; }
.shop-item-info p { margin:2px 0 0; font-size:11px; color:var(--text2); }
.shop-item-btn { border:none; padding:6px 16px; border-radius:8px; font-size:12px; font-weight:700; cursor:pointer; transition:all 0.15s; white-space:nowrap; }
.shop-item-btn.owned { background:#2ecc71; color:#fff; cursor:default; }
.shop-item-btn.buyable { background:#ffd700; color:#1a1a2e; }
.shop-item-btn.buyable:hover { background:#ffe44d; transform:scale(1.05); }
.shop-item-btn.locked { background:#555; color:#888; cursor:not-allowed; }

/* Changelog */
.cl-day { margin: 4px 0; }
.cl-date {
  font-size: 14px;
  font-weight: 700;
  color: #4fc3f7;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #2a3a5a;
}
.cl-items { display: flex; flex-direction: column; gap: 5px; }
.cl-items span { font-size: 13px; color: #ccc; line-height: 1.5; }
.cl-sep {
  border: none;
  border-top: 1px solid #2a2a4a;
  margin: 16px 0;
}

/* Online Players Panel */
.op-player {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  transition: background 0.2s;
}
.op-player:hover { background: rgba(255,255,255,0.03); }
.op-player.op-new {
  animation: op-appear 1.5s ease-out;
}
.op-dot { font-size: 10px; width: 16px; text-align: center; }
.op-name { color: #fff; font-weight: 600; font-size: 13px; flex: 1; }
.op-type { font-size: 10px; color: #888; }
.op-game { font-size: 11px; color: #4fc3f7; }

@keyframes op-appear {
  0% { background: rgba(79, 195, 247, 0.3); transform: translateX(-10px); opacity: 0; }
  40% { background: rgba(79, 195, 247, 0.15); transform: translateX(0); opacity: 1; }
  100% { background: transparent; }
}

/* ---- Skin Shop ---- */
.skin-shop-item {
  display: flex; align-items: center; gap: 12px;
  background: #1a1a2e; border: 1px solid #2a2a4a; border-radius: 10px;
  padding: 10px 14px; cursor: pointer; transition: all 0.15s;
}
.skin-shop-item:hover { border-color: #4a4a6a; background: #1e1e3a; }
.skin-shop-item.selected { border-color: #ff69b4; background: #2a1a3e; }
.skin-shop-item .skin-icon { font-size: 28px; width: 44px; text-align: center; }
.skin-shop-item .skin-info { flex: 1; }
.skin-shop-item .skin-name { color: #fff; font-weight: 600; font-size: 14px; }
.skin-shop-item .skin-desc { color: #888; font-size: 11px; margin-top: 2px; }
.skin-shop-item .skin-check { font-size: 18px; color: #4CAF50; }

