/* 2016-flavored skin */

* { box-sizing: border-box; }

:root {
  --tb-bg: #1d2025;
  --bg: #e3e3e3;
  --panel: #ffffff;
  --panel-border: #b8b8b8;
  --panel-head: linear-gradient(#fafafa, #ececec);
  --text: #2f3136;
  --muted: #74787f;
  --link: #0f71c4;
  --link-hover: #0a589c;
  --blue: #00a2ff;
  --green: #02b04e;
  --green-dark: #02913f;
}

html, body { margin: 0; padding: 0; }

body {
  font-family: "Source Sans Pro", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.container { width: 970px; max-width: 100%; margin: 0 auto; }

/* ---------- topbar ---------- */

#topbar {
  background: var(--tb-bg);
  border-bottom: 1px solid #000;
  position: sticky;
  top: 0;
  z-index: 50;
}

.tb-inner {
  width: 970px; max-width: 100%;
  margin: 0 auto;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 18px;
}

.logo {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.5px;
  color: #fff;
}
.logo:hover { color: #fff; text-decoration: none; }

.tb-nav { display: flex; gap: 0; height: 100%; }
.tb-nav a {
  color: #cfd3d9;
  padding: 0 12px;
  line-height: 40px;
  font-size: 14px;
}
.tb-nav a:first-child { padding-left: 0; }
.tb-nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,0.06); }

.tb-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.tb-search {
  display: flex;
  background: #2a2d33;
  border: 1px solid #454a52;
  border-radius: 3px;
  overflow: hidden;
}
.tb-search input {
  background: transparent;
  border: 0;
  color: #e8eaee;
  font: 13px "Source Sans Pro", sans-serif;
  padding: 4px 8px;
  width: 150px;
  outline: none;
}
.tb-search input::placeholder { color: #8a909a; }
.tb-search button {
  background: #34383f;
  border: 0;
  border-left: 1px solid #454a52;
  width: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tb-search button:hover { background: #3d424a; }
.mag {
  width: 11px; height: 11px;
  border: 2px solid #b7bcc4;
  border-radius: 50%;
  position: relative;
}
.mag::after {
  content: "";
  position: absolute;
  width: 2px; height: 6px;
  background: #b7bcc4;
  bottom: -5px; right: -4px;
  transform: rotate(-45deg);
}

.tb-robux {
  color: #d8dbe0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.tb-robux::before {
  content: "R$";
  font-size: 11px;
  font-weight: 700;
  color: #00a2ff;
  border: 1px solid #00a2ff;
  border-radius: 3px;
  padding: 0 2px;
}

#user-chip { display: flex; align-items: center; gap: 7px; color: #d8dbe0; font-size: 13px; }
#user-chip:hover { color: #fff; text-decoration: none; }
#user-chip img {
  width: 26px; height: 26px;
  border-radius: 3px;
  border: 1px solid #454a52;
  background: #34383f;
}

#login-link {
  color: #cfd3d9;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid #454a52;
  border-radius: 3px;
}
#login-link:hover { color: #fff; text-decoration: none; background: #34383f; }

#settings-link {
  color: #a7adb6;
  display: flex;
  align-items: center;
  padding: 5px;
  border-radius: 3px;
}
#settings-link:hover { color: #fff; text-decoration: none; background: #34383f; }

/* ---------- layout ---------- */

#page { flex: 1; padding: 16px 0 28px; }

.page-title {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 3px;
  margin-bottom: 16px;
}

.panel-head {
  background: var(--panel-head);
  border-bottom: 1px solid #d9d9d9;
  border-radius: 3px 3px 0 0;
  padding: 7px 12px;
  font-weight: 600;
  font-size: 14px;
  color: #454545;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-body { padding: 12px; }

/* ---------- game tiles ---------- */

.row-games { overflow-x: auto; padding: 12px 12px 4px; display: flex; gap: 10px; }
.row-games::-webkit-scrollbar { height: 8px; }
.row-games::-webkit-scrollbar-thumb { background: #c4c4c4; border-radius: 4px; }

.row-arrows { display: flex; gap: 4px; }
.row-arrows button {
  background: linear-gradient(#fafafa, #ececec);
  border: 1px solid #c2c2c2;
  border-radius: 3px;
  color: #555;
  width: 24px; height: 20px;
  line-height: 1;
  font-size: 12px;
  cursor: pointer;
}
.row-arrows button:hover { background: #e2e2e2; color: #222; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  padding: 12px;
}
.grid-more { padding: 0 12px 12px; text-align: center; }
.grid-more .btn-blue { margin: 0; width: 160px; height: 32px; font-size: 13px; }

.sort-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-weight: 600;
}
.sort-bar select {
  border: 1px solid #a9a9a9;
  border-radius: 3px;
  background: #fff;
  font: 13px "Source Sans Pro", sans-serif;
  padding: 4px 6px;
  color: var(--text);
}
.sort-all { font-size: 13px; font-weight: 400; }

.tile {
  width: 180px;
  flex: 0 0 180px;
  display: block;
}
.tile:hover { text-decoration: none; }

.tile .thumb,
.tile .name,
.tile .playing {
  display: block;
}

.tile .thumb {
  width: 180px; height: 101px;
  background: #dcdcdc;
  border: 1px solid #b0b0b0;
  border-radius: 2px;
  overflow: hidden;
}
.tile:hover .thumb { border-color: var(--link); }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .thumb img:not([src]) { display: none; }
.tile .name {
  font-size: 13px;
  line-height: 17px;
  margin-top: 5px;
  height: 34px;
  overflow: hidden;
  color: var(--link);
}
.tile:hover .name { color: var(--link-hover); }
.tile .playing { font-size: 11px; color: var(--muted); }

.game-grid .tile { width: auto; flex: none; }
.game-grid .tile .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; }

/* ---------- game detail ---------- */

.game-detail { display: flex; gap: 16px; }

.gd-media { width: 600px; flex: 0 0 600px; }
.gd-media .big-thumb {
  width: 100%;
  border: 1px solid var(--panel-border);
  border-radius: 2px;
  background: #d7d7d7;
  display: block;
  min-height: 200px;
  object-fit: cover;
}
.gd-side { flex: 1; min-width: 0; }
.gd-side h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 2px;
  line-height: 1.2;
  word-wrap: break-word;
}
.gd-creator { color: var(--muted); margin-bottom: 14px; }
.gd-creator a { font-weight: 600; }

.play-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 230px;
  height: 48px;
  background: linear-gradient(#06c45f, var(--green) 45%, var(--green-dark));
  border: 1px solid var(--green-dark);
  border-radius: 4px;
  color: #fff;
  font: 700 19px "Source Sans Pro", sans-serif;
  text-shadow: 0 1px 1px rgba(0,0,0,0.3);
  cursor: pointer;
  margin: 4px 0 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.play-btn:hover { background: linear-gradient(#06d167, #04c058 45%, #03a449); text-decoration: none; color: #fff; }
.play-btn:active { background: linear-gradient(#04a94e, #039a46); }
.play-btn:disabled { filter: grayscale(0.6) brightness(0.9); cursor: default; }
.play-btn .glyph {
  width: 0; height: 0;
  border-left: 14px solid #fff;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.3));
}

.stats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stats-table th, .stats-table td {
  text-align: left;
  padding: 5px 8px;
  border-bottom: 1px solid #e4e4e4;
}
.stats-table th { color: var(--muted); font-weight: 600; width: 110px; }
.stats-table tr:last-child th, .stats-table tr:last-child td { border-bottom: 0; }

.desc-text { white-space: pre-wrap; word-wrap: break-word; color: #3a3d42; }

/* ---------- login ---------- */

.login-wrap { max-width: 360px; margin: 40px auto 0; }
.login-wrap .panel-head { justify-content: flex-start; }
.login-form { padding: 4px 12px 12px; }
.login-form label { display: block; font-weight: 600; margin: 12px 0 4px; }
.login-form input[type="password"], .login-form select {
  width: 100%;
  border: 1px solid #a9a9a9;
  border-radius: 3px;
  padding: 7px 9px;
  font: 13px "Source Sans Pro", sans-serif;
  background: #fff;
  color: var(--text);
}
.login-form input[type="password"]:focus, .login-form select:focus {
  outline: 1px solid #6fb3e0;
  border-color: #6fb3e0;
}
.login-note { color: var(--muted); font-size: 12px; margin: 6px 0 0; }
.login-error { color: #c0392b; font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.btn-blue {
  margin-top: 16px;
  width: 100%;
  height: 38px;
  background: linear-gradient(#22b0ff, var(--blue) 45%, #0090e6);
  border: 1px solid #008ad6;
  border-radius: 3px;
  color: #fff;
  font: 600 15px "Source Sans Pro", sans-serif;
  cursor: pointer;
}
.btn-blue:hover { background: linear-gradient(#33bbff, #0cabff 45%, #0199e0); }
.btn-blue:disabled { filter: grayscale(0.5); cursor: wait; }

/* ---------- search ---------- */

.search-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 12px; }

/* ---------- footer ---------- */

#footer {
  border-top: 1px solid #cfcfcf;
  background: #eaeaea;
  padding: 10px 0;
  font-size: 12px;
  color: var(--muted);
}
#footer .container { display: flex; gap: 14px; align-items: center; }
#footer a { color: var(--muted); }

/* ---------- player ---------- */

#player-root {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
}
.player-stage { position: absolute; inset: 0; cursor: none; }
.player-video {
  width: 100vw;
  height: 100vh;
  object-fit: contain;
  background: #000;
  display: block;
}
#player-cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 104;
  display: none;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6));
}

.player-ui {
  position: fixed;
  top: 50%;
  right: 14px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  background: rgba(18, 20, 24, 0.82);
  border: 1px solid rgba(70, 76, 86, 0.9);
  border-radius: 6px;
  padding: 8px;
  opacity: 1;
  transition: opacity 0.35s, transform 0.35s;
  z-index: 101;
  min-width: 120px;
}
.player-ui.hidden {
  opacity: 0;
  transform: translateY(-50%) translateX(12px);
  pointer-events: none;
}
.player-ui button {
  background: rgba(20,22,26,0.85);
  border: 1px solid #454a52;
  color: #dfe2e7;
  border-radius: 3px;
  padding: 6px 10px;
  font: 13px "Source Sans Pro", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}
.player-ui button:hover { background: #2c3036; }
.player-title {
  color: #cfd3d9;
  font-size: 12px;
  margin: 0 2px 2px;
  line-height: 1.3;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-status {
  color: #9aa1ab;
  font-size: 11px;
  margin: 2px 2px 0;
  min-height: 13px;
}

.join-dialog {
  position: fixed;
  inset: 0;
  background: rgba(10,12,16,0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 102;
}
.join-card {
  width: 340px;
  background: #fff;
  border-radius: 4px;
  border: 1px solid #9a9a9a;
  padding: 18px 20px;
  text-align: center;
}
.join-card h2 { margin: 0 0 6px; font-size: 18px; color: #2f3136; }
.join-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.join-bar {
  height: 10px;
  border: 1px solid #b6b6b6;
  border-radius: 3px;
  overflow: hidden;
  background: #e6e6e6;
}
.join-bar i {
  display: block;
  height: 100%;
  width: 34%;
  background: repeating-linear-gradient(45deg, #06c45f 0 10px, #02b04e 10px 20px);
  animation: joinbar 1.1s linear infinite;
}
@keyframes joinbar { from { background-position: 0 0; } to { background-position: 28px 0; } }
.join-error { color: #c0392b; }

.unmute-hint {
  position: fixed;
  bottom: 70px; left: 50%;
  transform: translateX(-50%);
  z-index: 101;
}
.unmute-hint button {
  background: #02b04e;
  border: 1px solid var(--green-dark);
  color: #fff;
  font: 600 14px "Source Sans Pro", sans-serif;
  padding: 9px 18px;
  border-radius: 4px;
  cursor: pointer;
}

/* ---------- misc ---------- */

#toast {
  position: fixed;
  top: 52px;
  left: 50%;
  transform: translate(-50%, -8px);
  background: #fff;
  border: 1px solid #9a9a9a;
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  padding: 9px 16px;
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty-note { color: var(--muted); padding: 24px 12px; text-align: center; }
.crumbs { font-size: 12px; color: var(--muted); margin: 0 0 8px; }

@media (max-width: 1000px) {
  .container, .tb-inner { width: auto; padding-left: 12px; padding-right: 12px; }
  .game-detail { flex-direction: column; }
  .gd-media { width: auto; flex: auto; }
  .tb-nav a:nth-child(n+3) { display: none; }
  .tb-search input { width: 100px; }
  .game-grid { grid-template-columns: repeat(2, 1fr); }
  .search-list { grid-template-columns: repeat(2, 1fr); }
}
