:root {
  --lobby-bg: radial-gradient(circle at top, #e8f0ff 0%, #f7f7fb 40%, #fdfdfd 100%);
  --card-bg: #ffffff;
  --card-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
  --accent: #1f6feb;
  --accent-dark: #1a4fbf;
  --text-main: #0f172a;
  --text-muted: #5b6478;
}
*{
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Noto Sans', 'Roboto', system-ui, -apple-system, sans-serif;
  /* background: var(--lobby-bg); */
  color: var(--text-main);
  background: #131b29;
  line-height: 1.1;
}
.chess-main{
  width: 100%;
  display: flex;
  gap: 16px;
  height: 100%;
}
.chess-right-side{
  text-align: center;
  flex: 1;
}
.chess-right-side-bottom{
  background: #162b3c;
  border-radius: 6px 6px 0 0;
  height: calc(100% - 92px);
}
.player-active-block {
    background: #294d6d none repeat scroll 0 0;
    color: #ffffff;
    margin-top: 0;
    padding: 18px;
    width: 100%;
    margin-bottom: 15px;
    text-align: left;
}
.player-active-block>p {
    font-size: 14px;
    letter-spacing: 0.5px;
}
.player-active-block span {
    font-size: 18px;
    padding-right: 7px;
    font-weight: bold;
}
.video-sidebar-container-header{
    height: 60px;
    background-color: #016066;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    font-size: 16px;
}
.video-sidebar-container-header h1 {
    position: relative;
    float: left;
    top: 52%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-transform: uppercase;
    color: #a5d1c2;
    font-weight: normal;
    line-height: 19px;
}
.video-sidebar-item {
    margin-top: 30px;
    padding: 0px 15px;
}
.video-sidebar-item img {
    border: 2px solid #FFF;
    opacity: 0.7;
}
.video-sidebar-item h2 {
    margin-top: 3px;
    font-size: 13px;
    color: #00a9ff;
}
.video-sidebar-item:hover h2{
    color: #5ccffb;
}
.video-sidebar-item:hover img {
    border: 2px solid #5ccffb;
    opacity: 1.0;
}
.all-videos-link {
    height: 60px;
}
.all-videos-link a {
    position: relative;
    float: left;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #FFF;
}
.all-videos-link a:hover {
    color: #5ccffb;
}
.lobby {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.lobby-card {
  background: var(--card-bg);
  padding: 40px 48px;
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.lobby-card h1 {
  margin: 0 0 8px;
  font-size: 32px;
}

.lobby-subtitle {
  margin: 0 0 24px;
  color: var(--text-muted);
}

.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid #cbd5f0;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  background: #f8fafc;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lobby-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(30, 64, 175, 0.15);
}

.lobby-button.primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.lobby-button.primary:hover {
  background: var(--accent-dark);
}

.match {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  gap: 20px;
}

.lobby-start {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: url('images/start-bg-board.png?v=1773625844393') center/100% 100% no-repeat;
  position: relative;
}

.lobby-start::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.lobby-start-card {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.lobby-start-card h1 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}

.lobby-start-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lobby-start-btn {
  display: inline-flex;
  cursor: pointer;
  text-indent: -9999px;
  height: 40px;
  width: 242px;
  border: 0;
  outline: none;
}
button.random-opponent{
    background: url(./images/chessgame_image.png?v=1773625844393) no-repeat;
    background-position: -316px -10px;
}
button.random-opponent:hover{
  background-position: -306px -68px;
}
button.vs-computer{
    background: url(./images/chessgame_image.png?v=1773625844393) no-repeat;
    background-position: -6px -94px;
}
button.vs-computer:hover{
  background-position: -6px -152px;
}
a.play-with-friend{
    background: url(./images/chessgame_image.png?v=1773625844393) no-repeat;
    background-position: -6px -209px;
}
a.play-with-friend:hover{
     background-position: -6px -267px;
}
.lobby-start-btn.stats-btn {
  text-indent: 0;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 16px; 
  font-weight: 700;
  letter-spacing: 1px;
  text-decoration: none;
  background: #2ea9d4;
  border-radius: 24px;
  border: 3px solid rgba(255, 255, 255, 0.6);
}
.lobby-start-btn.stats-btn:hover {
  background: #3bbbe9;
}


.ai-modal {
  position: fixed;
  inset: 0;
  /* background: rgba(0, 0, 0, 0.7); */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
}

.ai-modal-close {
  position: absolute;
  top: -15px;
  right: -8px;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  background: url(./images/close_button.png?v=1773625844393);
  text-indent: -9999px;
}

.ai-modal-section {
  margin-bottom: 18px;
}

.ai-modal-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #7a7a7a;
  font-weight: 700;
}

.ai-levels {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 6px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f2f4f7;
}

.ai-level-btn {
  background: #ffffff;
  border: 1px solid #d1d5db;
  padding: 8px 0;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
}
.ai-level-btn:hover{
  border-color: #7cc6e8;
}

.ai-level-btn.active {
  background: #5ec1e6;
  border-color: #5ec1e6;
  color: #ffffff;
}

.ai-colors {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.ai-color-btn {
  width: 76px;
  height: 64px;
  border: 2px solid #d1d5db;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.ai-color-btn:hover{
  border-color: #7cc6e8;
}

.ai-color-btn.active {
  border-color: #7cc6e8;
  box-shadow: inset 0 0 0 2px #7cc6e8;
}

.ai-color-icon {
  display: block;
  width: 40px;
  height: 40px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.ai-color-icon.white {
  background-image: url('images/pieces/merida/wK.svg?v=1773625844393');
}

.ai-color-icon.black {
  background-image: url('images/pieces/merida/bK.svg?v=1773625844393');
}

.ai-color-icon.random {
  background-image: url('images/pieces/merida/random.svg?v=1773625844393');
  position: relative;
}

/* .ai-color-icon.random::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url('images/pieces/merida/bK.svg?v=1773625844393');
  background-size: 70%;
  background-repeat: no-repeat;
  background-position: 70% 60%;
  opacity: 0.9;
} */

.ai-start-btn {
  margin-top: 8px;
  padding: 10px 24px;
  border-radius: 999px;
  border: 2px solid #5ec1e6;
  background: #5ec1e6;
  color: #ffffff;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
}
.ai-start-btn:hover{
  background: #429abc;
}
.random-modal {
  position: fixed;
  inset: 0;
  /* background: rgba(0, 0, 0, 0.7); */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  left: 0;
  top: 0;
  max-width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
}

.random-modal-card,
.ai-modal-card,
.friend-modal-card {
  width: 96%;
  background: #ffffff;
  padding: 15px;
  position: relative;
  text-align: center;
  border-radius: 8px;
}

.random-modal-card h2,
.ai-modal-card h2,
.friend-modal-card h2 {
  margin: 0 0 15px;
  font-size: 19px;
  color: #666666;
  letter-spacing: 1px;
}

.random-modal-close {
  position: absolute;
  top: -15px;
  right: -8px;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  background: url(./images/close_button.png?v=1773625844393);
  text-indent: -9999px;
}

.random-modal-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: start;
}

.random-modal-divider {
  font-weight: 700;
  color: #9aa3ad;
  margin-top: 90px;
}

.random-modal-section {
  min-height: 360px;
  text-align: left;
  height: 100%;
}
.inner-fields{
  border: 1px solid #d1d5db;
  padding: 10px 12px 5px;
}

.random-modal-section h3 {
  margin: 0 0 8px;
  text-align: center;
  font-size: 16px;
  color: #777;
}

.random-table {
  border: 1px solid #d1d5db;
  overflow: hidden;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  height: calc(100% - 72px)
}

.random-table-header {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 0.8fr;
  gap: 8px;
  padding: 10px 12px;
  background: #f1f5f9;
  font-weight: 700;
  color: #6b7280;
  text-align: center;
}

.random-table-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  max-height: 330px;
}

.random-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr 0.8fr;
  gap: 8px;
  padding: 5px 12px;
  border: 0;
  border-bottom: 1px solid #d1d5db;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  width: 100%;
}
.random-row:hover{
  background: rgba(200, 255, 200, 0.7);
}

.random-row.active {
  background: #d1fae5;
}

.random-cell {
  color: #4b5563;
  line-height: 28px;
  text-align: center;
}
.random-cell.random-cell-speed{
  color: #23b0db
}

.random-cell-level{
  text-indent: -9999px;
}

.random-cell-level.beginner{
  background: url('./images/b1t.png?v=1773625844393') no-repeat center/100%;
  width: 28px;
  height: 28px;
  margin: auto;
}
.random-cell-level.medium{
  background: url('./images/b2t.png?v=1773625844393') no-repeat center/100%;
  width: 28px;
  height: 28px;
  margin-left: 6px;
}
.mobile .random-color-btn{
  height: 57px;
}
.mobile .ai-color-icon{
  width: 35px;
  height: 35px;
}
.random-cell-level.advanced{
  background: url('./images/b3t.png?v=1773625844393') no-repeat center/100%;
  width: 28px;
  height: 28px;
  margin-left: 6px;
}
.random-cell.color-cell{
  font-size: 0;
}
.random-cell.color-cell:before{
    font-size: 18px;
    vertical-align: middle;
    font-family: "lichess" !important;
    font-style: normal !important;
    font-weight: normal !important;
    text-transform: none !important;
    speak: none;
    line-height: 1;
    -webkit-font-smoothing: antialiased;
}
.random-cell.R::before{
    content: "l";
}
.random-cell.W::before{
    content: "K";
}
.random-cell.B::before{
    content: "J";
}
.random-empty {
  padding: 16px;
  text-align: center;
  color: #9ca3af;
}

.random-join-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

.random-btn {
  padding: 10px 18px;
  border-radius: 999px;
  border: 2px solid #5ec1e6;
  background: #5ec1e6;
  color: #ffffff;
  font-weight: bold;
  cursor: pointer;
}
.random-btn:hover{
  border-color:  #297d9d;
  background: #429abc;
}

.random-btn.primary {
  width: 100%;
  margin-top: 8px;
}

.random-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.random-status {
  color: #b91c1c;
  position: absolute;
  bottom: 5px;
}

.random-field {
  margin-bottom: 10px;
}

.random-field label {
  display: block;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 6px;
}

.random-field h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #6b7280;
}

.random-field input[type="range"] {
  width: 100%;
  accent-color: #1d92c0;
}

.random-levels {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.random-level-btn {
  border: 2px solid #d1d5db;
  background: #ffffff;
  padding: 5px 8px 7px;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.random-level-btn:hover{
  border-color: #7cc6e8;
  color: #1f2937;
}

.random-level-btn.active {
  border-color: #7cc6e8;
  box-shadow: inset 0 0 0 2px #7cc6e8;
  color: #1f2937;
}

.random-colors {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.random-color-btn {
  height: 64px;
  border: 2px solid #d1d5db;
  background: #ffffff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.random-color-btn:hover{
  border-color: #7cc6e8;
}

.random-color-btn.active {
  border-color: #7cc6e8;
  box-shadow: inset 0 0 0 2px #7cc6e8;
}

.random-waiting {
  text-align: center;
  margin-top: 5px;
  font-weight: 700;
  color: #111827;
  font-size: 14px;
}



.match-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
}

.match-header h1 {
  margin: 8px 0 0;
  font-size: 28px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.match-meta {
  display: grid;
  grid-template-columns: auto auto;
  gap: 6px 16px;
  font-size: 14px;
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.meta-label {
  color: var(--text-muted);
  font-weight: 600;
}

.meta-value {
  font-weight: 600;
}

.match-board {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.board-wrap {
  width: 540px;
  height: 540px;
}

.cg-512 {
  flex-shrink: 0;
  aspect-ratio: 1 / 1;
  padding-right: 16px;
  padding-bottom: 16px;
  background: #fff;
  position: relative;
  height: 100%;
}

.board-result-overlay {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.board-result-overlay.hidden {
  display: none;
}

.board-result-text {
  color: #0a0a0a;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(34px, 7vw, 64px);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-shadow:
    -2px -2px 0 rgba(255, 255, 255, 0.95),
    2px -2px 0 rgba(255, 255, 255, 0.95),
    -2px 2px 0 rgba(255, 255, 255, 0.95),
    2px 2px 0 rgba(255, 255, 255, 0.95);
  white-space: pre-line;
  line-height: 1.05;
  text-align: center;
}
body[data-mode="ai-rail"] #play-vs-ai section {
  display: block;
  padding: 0;
  margin: 0;
  background: transparent;
  border-radius: 0;
  vertical-align: top;
  height: calc(100% - 20px)
}

body[data-mode="ai-rail"] #play-vs-ai section p {
  display: none;
  margin: 0;
}

body[data-mode="ai-rail"] #play-vs-ai .cg-wrap {
  width: 520px;
  height: 520px;
}

.cg-wrap piece {
  width: 12.5%;
  height: 12.5%;
  top: 0;
  left: 0;
}

.moves-panel {
  flex: 1;
  background: #2b4f6d;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #ffffff;
}

.rail-top {
  flex: 0 0 auto;
}

.rail-top-bar {
  background: #2f7fd1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}

.rail-clock-time {
  font-weight: bold;
  font-size: 16px;
  letter-spacing: 2px;
  background: #2b4f6d;
  color: #ffffff;
  border: 2px solid #ffffff;
  padding: 4px 6px;
}

.rail-status {
  background: linear-gradient(180deg, #f39c12, #e67e22);
  padding: 8px 12px;
  text-align: center;
  font-weight: bold;
  border-top: 1px solid rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  flex: 0 0 auto;
  font-size: 14px;
}

.rail-controls {
  background: #2b4f6d;
  border-bottom: 1px solid #1e3a54;
  flex: 0 0 auto;
}

.moves-controls {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: transparent;
  border-bottom: 1px solid #1e3a54;
}

.move-btn {
  flex: 1;
  border: 1px solid #6c8aa3;
  background: transparent;
  color: #ffffff;
  padding: 7px 0;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  font-size: 0;
}
.move-btn:before{
  font-size: 16px;
  vertical-align: middle;
  font-family: "lichess" !important;
  font-style: normal !important;
  font-weight: normal !important;
  text-transform: none !important;
  speak: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
}
.move-btn#move-live::before{
  content: "B";
}
.move-btn#move-first::before{
  content: "0";
}
.move-btn#move-prev::before{
  content: "Y";
}
.move-btn#move-next::before{
  content: "X";
}
.move-btn#move-last::before{
  content: "V";
}
.move-btn:hover{
  background: #224059;
}

.move-btn.disabled {
  opacity: 0.4;
  cursor: default;
}

.rail-header {
  padding: 8px 12px;
  font-weight: 700;
  border-bottom: 1px solid #1e3a54;
  flex: 0 0 auto;
  font-size: 13px;
}

.rail-moves {
  padding: 0 10px 8px;
  flex: 1 1 auto;
  min-height: 0;
}

.moves-panel .replay .moves {
  height: 100%;
  overflow-y: auto;
  border-top: none;
  border-bottom: none;
}

.rail-moves .lichess_ground,
.rail-moves .replay,
.rail-moves .moves {
  height: 100%;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #1e3a54;
  flex: 0 0 auto;
  font-size: 13px;
}

.takeback-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid #1e3a54;
  flex-wrap: wrap;
}

.takeback-panel.hidden {
  display: none;
}

.takeback-text {
  font-weight: 700;
  color: #d9e6f2;
}

.takeback-btn {
  border: 1px solid #9db3c5;
  background: transparent;
  color: #ffffff;
  border-radius: 6px;
  padding: 4px 10px;
  font-weight: 700;
  cursor: pointer;
}

.takeback-btn.hidden {
  display: none;
}

.rail-actions .rail-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: 1px solid #9db3c5;
  color: #ffffff;
  background: transparent;
  text-decoration: none;
  font-weight: bold;
}
.rail-actions .rail-action-btn:hover{
  background: #224059;
}

.rail-bottom {
  margin-top: 0;
  background: #2f7fd1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 2px solid rgba(255,255,255,0.2);
  flex: 0 0 auto;
}

.rail-clock-time.bottom {
  border: 2px solid #ffffff;
  padding: 4px 6px;
  font-size: 16px;
  letter-spacing: 2px;
  background: #2b4f6d;
  color: #ffffff;
}

.rail-clock-time.active {
  background: #f3dd62;
  color: #1b1b1b;
}

.rail-label {
  font-weight: bold;
  font-size: 16px;
}

.rail-moves .moves {
  height: 110px;
  overflow-y: auto;
}

.rail-actions {
  margin-top: 8px;
}

.rail-turn {
  font-weight: bold;
  font-size: 16px;
}



body.blue .is2d .cg-board {
  background-image: url('../images/board/8x8blue.svg?v=1773625844393');
}

.match-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.friend-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.friend-card {
  background: #ffffff;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.friend-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.friend-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  height: 100%;
  aspect-ratio: 1 / 1;
  max-width: 100%;
}

.friend-modal-close {
  position: absolute;
  top: -15px;
  right: -8px;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  background: url(./images/close_button.png?v=1773625844393);
  text-indent: -9999px;
}

.friend-modal-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
}

.friend-modal-divider {
  font-weight: 700;
  color: #9aa3ad;
  margin-top: 60px;
}

.friend-modal-section {
  border: 1px solid #d4d8dd;
  padding: 16px;
  padding-bottom: 10px;
  border-radius: 6px;
  background: #f8f9fb;
  min-height: 240px;
}

.friend-modal-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #777;
}

.friend-modal-section p {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 12px;
}

.friend-create-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.friend-create-field label {
  display: block;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
  font-weight: 700;
}

.friend-create-field h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #6b7280;
}

.friend-create-field input[type="range"] {
  width: 100%;
}

.friend-modal-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid #c7cdd4;
  margin-bottom: 12px;
  text-align: center;
  letter-spacing: 2px;
}

.friend-modal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid #5ec1e6;
  background: #5ec1e6;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}
.friend-modal-btn:hover{
  background: #429abc;
  border-color: #297d9d;
}

.friend-modal-btn.primary {
  background: #2ea9d4;
  border-color: #2ea9d4;
}
.friend-modal-btn.primary:hover{
  background: #429abc;
  border-color: #297d9d;
}

.friend-modal-code {
  margin-top: 12px;
}

.friend-modal-code.hidden {
  display: none;
}

.friend-modal-code-box {
  display: flex;
  justify-content: center;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.friend-modal-code-box span {
  background: #eeeeee;
  border: 1px solid #c7cdd4;
  padding: 7px 18px;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 2px;
}

.friend-modal-copy {
  padding: 10px 14px;
  border: 1px solid #c7cdd4;
  background: #f3f4f6;
  cursor: pointer;
  font-weight: 700;
}

.friend-modal-note {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 0 !important;
}

.friend-modal-status {
  margin-top: 12px;
  font-weight: 700;
  color: #b91c1c;
  left: 30px;
  position: absolute;
}

.friend-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.friend-modal-cancel {
  border: 1px solid #d1d5db;
  background: #f9fafb;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 700;
  color: #666;
  display: none;
}
.friend-modal-cancel:hover{
  background: #d9dbdc;
}

.friend-card p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.friend-join {
  display: flex;
  gap: 10px;
  align-items: center;
}

.friend-input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #cbd5f0;
  font-size: 14px;
}

.private-code {
  margin-top: 12px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--accent);
}

.game-status {
  color: var(--text-muted);
  font-weight: 600;
}


/*for mobile */
 .mobile .match {
    padding: 16px;
  }

 .mobile .match-header {
    flex-direction: column;
  }

.mobile .board-wrap {
    width: min(90vw, 420px);
    height: min(90vw, 420px);
  }

.mobile .random-modal,
.mobile .ai-modal,
.mobile .friend-modal{
  background: rgba(0, 0, 0, 0.7);
  /* align-items: flex-start;
  top: 20px; */
  width: 100%;
  height: 100%;
}
.mobile body.embed{
  max-height: none;
  max-width: 100%;
}
.mobile .video-sidebar-item{
  display: flex;
  text-align: left;
  margin-top: 10px;
  padding: 0;
}
.mobile .video-sidebar-item a{
  display: flex;
  align-items: center;
}
.mobile .video-sidebar-item img{
  width: 75px;
}
.mobile .random-join-actions{
  display: none;
}
.mobile .random-field{
  margin-bottom: 5px;
}
.mobile .random-field h4{
  margin-bottom: 5px;
  font-size: 12px;
}
.mobile .random-modal-grid{
  gap: 5px;
}
.mobile .video-sidebar-item h2{
  padding-left: 10px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mobile .lobby-start{
  height: 100vh;
  width: 100vh;
}
.mobile .chess-right-side{
  flex: 1;
}
.mobile .chess-right-side-bottom{
  height: auto;
}
.mobile .video-sidebar-container-header{
  height: 60px;
}
.mobile .player-active-block{
  padding: 10px;
}

.mobile .random-modal-grid{
  max-height: calc(100vh - 80px);
  overflow: auto;
}
.mobile .friend-modal-grid{
  max-height: calc(100vh - 110px);
  overflow: auto;
  gap: 5px;
}
.mobile .random-row{
  padding: 0px 12px;
}
.mobile .random-empty{
  padding: 5px 10px;
}
.mobile .friend-modal-card h2,
.mobile .random-modal-card h2,
.mobile .ai-modal-card h2{
  margin-bottom: 3px;
  font-size: 16px;
}
.mobile .friend-modal-card h2{
  margin-bottom: 8px;
}
.mobile .random-modal-section h3{
  font-size: 14px;
}
.mobile .random-level-btn{
  padding: 5px;
}
.mobile .random-level-btn img{
  max-width: 30px;
  height: auto;
}
.mobile .random-modal-card,
.mobile .friend-modal-card,
.mobile .ai-modal-card{
  padding: 10px;
}
.mobile .friend-modal-actions{
  margin-top: 5px;
}
.mobile .friend-modal-section{
  padding: 5px 10px;
}
.mobile .friend-modal-section h3{
  margin-bottom: 3px;
  font-size: 14px;
}
.mobile .friend-create-fields{
  gap: 5px;
  margin-bottom: 5px;
}
.mobile .random-level-btn.active,
.mobile .random-color-btn.active{
  box-shadow: none;
}
.mobile .random-modal-section{
  min-height: 0;
}
.mobile .friend-modal-btn{
  padding-top: 5px;
  padding-bottom: 5px;
}
.mobile .friend-modal-input{
  margin-bottom: 5px;
  padding: 5px 12px;
}
.mobile .friend-modal-section{
  min-height: 0;
}
.mobile .friend-create-field label,
.mobile .friend-create-field h4{
  font-size: 12px;
}
.mobile .ai-modal-section{
  margin-bottom: 5px;
}
.mobile .ai-color-btn.active{
  box-shadow: none;
}
.mobile .ai-color-btn{
  width: 50px;
  height: 50px;
}
.mobile .ai-start-btn{
  padding-top: 7px;
  padding-bottom: 7px;
}
.mobile .ai-modal-section h3{
  font-size: 14px;
}
.mobile .ai-modal-close,
.mobile .random-modal-close,
.mobile .friend-modal-close{
  zoom: 0.8;
}
.mobile .cg-wrap{
  outline: 16px solid #fff;
}
.mobile .lichess_ground .replay turn > move{
  font-size: 15px;
}
.mobile .rail-status,
.mobile .rail-top-bar,
.mobile .rail-bottom{
  padding: 6px 10px;
}
.mobile .rail-label,
.mobile .rail-turn{
  font-size: 14px;
}
.mobile .rail-clock-time{
  font-size: 12px !important;
}
.landscape.mobile .video-sidebar-items{
    max-height: calc(100vh - 185px);
    overflow: auto;
}
.landscape.mobile .random-table{
  height: calc(100% - 59px);
}
.landscape.mobile .chess-right-side-bottom{
  height: calc(100% - 75px);
}
@media (max-height: 500px) {
.landscape.mobile .ai-color-icon{
    width: 25px;
    height: 25px;
  }
  .landscape.mobile .random-color-btn{
    height: 35px;
  }
  .landscape.mobile .random-level-btn img{
    max-width: 25px;
  }
  .landscape.mobile .random-level-btn{
    padding: 2px;
    font-size: 11px;
  }
  .landscape.mobile .random-btn{
    padding-top: 5px;
    padding-bottom: 5px;
  }
  .landscape.mobile .friend-create-field h4{
    margin-bottom: 3px;
  }
  .landscape.mobile .friend-create-fields{
    gap: 0;
  }
  .landscape.mobile .friend-modal-card{
    padding-bottom: 5px;
  }
  .landscape.mobile .random-field label{
    margin-bottom: 0;
  }
  .landscape.mobile .random-field{
    margin-bottom: 2px;
  }
  .landscape.mobile .inner-fields{
    padding-top: 3px;
  }
  .landscape.mobile .random-modal-card{
    zoom: 0.8;
  }
}
  .portrait.mobile .cg-512{
    height: 100vw;
    z-index: 0;
    padding: 16px;
  }
   .mobile .cg-512{
    padding: 16px;
  }
  .portrait.mobile .cg-512:after{
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    background: url(images/board/8x8maple.png?v=1773625844393) 0 0/ cover  no-repeat;
    filter: blur(10px);
    z-index: -1;
  }
  .portrait.mobile .random-table{
    height: auto;
  }
  .portrait.mobile .match-board{
    flex-direction: column;
  }
  html.portrait.mobile{
    overflow: auto;
  }
  .portrait.mobile .chess-main{
    flex-direction: column;
  }
  .portrait.mobile .chess-right-side{
    width: 100%;
    padding: 0 10px;
  }
  .portrait.mobile .lobby-start{
    height: 100vw;
    width: 100vw;
  }
  .portrait.mobile .random-modal-section,
  .portrait.mobile .friend-modal-section{
    min-height: 0;
    height: auto;
  }
  .portrait.mobile .random-modal-divider,
  .portrait.mobile .friend-modal-divider{
    margin-top: 0;
  }
  .portrait.mobile .random-modal-grid{
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 80px);
  }
  .portrait.mobile .friend-modal-grid{
    grid-template-columns: 1fr;
  }
  .mobile .rail-actions{
    flex-direction: row;
  }
  .mobile .rail-actions .rail-action-btn{
    flex: 1;
  }

  .portrait.small-portrait.mobile .cg-512{
    height: 45vh;
  }

@media (max-width: 900px) {
  .landscape.mobile .moves-panel{
    zoom: 0.7;
  }
}