:root{
  --sidebar-w: 220px;
  --header-h: 54px;
  --gap: 14px;
  --pad: 14px;

  --log-w: 190px;
  --log-max: 220px;

  --square: 44px;
  --board: calc(var(--square) * 8);
}

html, body{
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body{
  background: radial-gradient(circle at top, #2b2b2b 0%, #111 60%, #050505 100%);
  color: #f2f2f2;
  font-family: Georgia, serif;
}

.app-container{
  height: 100vh;
  display: flex;
}

.sidebar{
  width: var(--sidebar-w);
  background: #0d0d0d;
  border-right: 1px solid rgba(255,215,0,0.18);
  padding: 18px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

.logo{
  font-size: 22px;
  color: #f5d98a;
  text-align: center;
}

.logo-sub{
  font-size: 12px;
  opacity: 0.75;
  text-align: center;
  margin-top: 6px;
}

.nav{
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-btn{
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,215,0,0.18);
  color: #f2f2f2;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn:hover{
  background: rgba(255,215,0,0.10);
}

.nav-btn.active{
  background: rgba(255,215,0,0.18);
}

.sidebar-footer{
  margin-top: auto;
}

.follow-btn{
  display: block;
  text-align: center;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #d4af37, #b8952e);
  color: black;
  font-weight: bold;
  text-decoration: none;
  transition: 0.2s;
}

.follow-btn:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(255,215,0,0.25);
}

.main-content{
  flex: 1;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.page{
  display: none;
  height: 100%;
}

.page.active{
  display: block;
}

h1{
  height: var(--header-h);
  line-height: var(--header-h);
  margin: 0;
  text-align: center;
  font-size: 28px;
}

.tables{
  height: calc(100vh - var(--header-h));
  padding: var(--pad);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--gap);
  align-items: center;
  justify-items: center;
}

.table{
  display: flex;
  justify-content: center;
  align-items: center;
}

.table.bottom{
  grid-column: 1 / span 2;
}

.card{
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: #151515;
  border: 1px solid rgba(255,215,0,0.22);
}

.board-col{
  width: var(--board);
  flex: 0 0 var(--board);
}

h2{
  margin: 0 0 8px;
  text-align: center;
  font-size: 16px;
  color: #f5d98a;
}

.board{
  width: var(--board);
  height: var(--board);
  display: grid;
  grid-template-columns: repeat(8, var(--square));
  grid-template-rows: repeat(8, var(--square));
  border-radius: 10px;
  overflow: hidden;
}

.board > div{
  width: var(--square);
  height: var(--square);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.board img{
  width: calc(var(--square) * 0.8);
  height: calc(var(--square) * 0.8);
  object-fit: contain;
}

.board span{
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  opacity: 0.5;
}

.move-log{
  width: var(--log-w);
  height: var(--board);
  background: #0f0f0f;
  border-radius: 10px;
  padding: 8px;
  overflow-y: auto;
  font-size: 12px;
  border: 1px solid rgba(255,215,0,0.18);
}

.move-log h3{
  margin: 2px 0 8px;
  text-align: center;
  font-size: 12px;
  color: #f5d98a;
}

.move-entry{
  margin-bottom: 4px;
  padding: 3px 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.white-move{ color: #fff; }
.black-move{ color: #bbb; }

.create-container{
  padding: 22px;
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
}

.card-surface{
  background: #151515;
  border: 1px solid rgba(255,215,0,0.22);
  border-radius: 14px;
  padding: 16px;
}

.create-form form{
  display: flex;
  flex-direction: column;
}

.create-form input,
.create-form textarea{
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(0,0,0,0.35);
  color: #f2f2f2;
  margin-bottom: 10px;
}

.create-form textarea{
  height: 130px;
}

.create-form button{
  padding: 12px;
  background: #d4af37;
  border: none;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.create-info h3{
  color: #f5d98a;
}

.mobile-header{
  display: none;
}

@media (max-width: 900px){

  html, body{
    overflow: auto;
  }

  .mobile-header{
    display: flex;
    align-items: center;
    height: 54px;
    background: #0d0d0d;
    border-bottom: 1px solid rgba(255,215,0,0.18);
    padding: 0 15px;
    position: sticky;
    top: 0;
    z-index: 1000;
  }

  .mobile-title{
    margin-left: 15px;
    font-weight: bold;
    color: #f5d98a;
  }

  .hamburger{
    background: none;
    border: none;
    font-size: 22px;
    color: #f5d98a;
    cursor: pointer;
  }

  .sidebar{
    position: fixed;
    left: -260px;
    top: 0;
    height: 100%;
    z-index: 999;
    transition: 0.3s ease;
  }

  .sidebar.open{
    left: 0;
  }

  .app-container{
    flex-direction: column;
  }

  .main-content{
    height: auto;
  }

  .tables{
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
  }

  .table.bottom{
    grid-column: auto;
  }

  :root{
    --square: 36px;
  }

  .create-container{
    grid-template-columns: 1fr;
    height: auto;
  }

  .create-form,
  .create-info{
    width: 100%;
  }

  .card{
    flex-direction: column;
    align-items: center;
  }

  .move-log{
    width: 100%;
    height: 200px;
  }
}


.loading-overlay{
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, #1b1b1b 0%, #0a0a0a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition: opacity 0.6s ease;
}

.loading-overlay.hidden{
  opacity: 0;
  pointer-events: none;
}

.loading-box{
  text-align: center;
}

.loading-text{
  font-size: 20px;
  color: #f5d98a;
  letter-spacing: 0.5px;
}

.dots::after{
  content: "";
  animation: dotsAnim 1.5s infinite steps(3);
}

@keyframes dotsAnim{
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}

.loading-overlay{
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(27,27,27,0.92) 0%, rgba(10,10,10,0.92) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  transition: opacity 0.6s ease;
  backdrop-filter: blur(2px);
}

.loading-overlay.hidden{
  opacity: 0;
  pointer-events: none;
}

.loading-box{
  text-align: center;
  padding: 18px 22px;
  border-radius: 14px;
  border: 1px solid rgba(255,215,0,0.22);
  background: rgba(0,0,0,0.35);
  box-shadow: 0 12px 30px rgba(0,0,0,0.6);
}

.loading-text{
  font-size: 18px;
  color: #f5d98a;
  letter-spacing: 0.4px;
}

.dots::after{
  content: "";
  animation: dotsAnim 1.2s infinite steps(3);
}

@keyframes dotsAnim{
  0% { content: ""; }
  33% { content: "."; }
  66% { content: ".."; }
  100% { content: "..."; }
}