:root{
  --topbar-bg: #24252f;
  --sidebar-bg: #1f1f28;
  --content-bg: #000000;
  --section-bg: #23252E;
  --accent: #2563eb;
  --text-on-top: #ffffff;
  --muted: #A0AEC0;
  --online: #22c55e;

  --topbar-height: 100px;
  --sidebar-width: 265px;

  --logo-box-w: 265px;
  --logo-box-h: 100px;
  --logo-img-w: 175px;
  --logo-img-h: 55.34px;

  --btn-color: rgb(160, 174, 192);
  --btn-hover: rgb(33, 150, 243);
}

@font-face {
  font-family: "Rubik";
  src: url('../fonts/Rubik-Regular.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
}

/* reset */
*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}

body{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background-color:#1a1c24;
  display:flex;
  flex-direction:column;
  background-image:url('../images/background.svg');
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
}

/* topbar */
.topbar{
  height:var(--topbar-height);
  background-color:var(--topbar-bg);
  display:flex;
  align-items:center;
  padding:0;
  position:relative;
}

.topbar::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  background-image:url('../images/pattern.png');
  background-repeat:repeat;
  background-size:auto;
  opacity:0.25;
  pointer-events:none;
}

.topbar-nav{
  display:flex;
  align-items:center;
  gap:16px;
  margin-left:16px;
  height:100%;
  position:relative;
  z-index:1;
  flex:1;
}

.topbar-btn{
  background:none;
  border:none;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-family: "Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  font-style:normal;
  color:var(--btn-color);
  transition:color 0.5s ease;
  padding:0;
  height:auto;
  gap:8px;
}

.topbar-btn svg{
  width:16px;
  height:16px;
  flex-shrink:0;
}

.topbar-btn span{
  white-space:nowrap;
}

.topbar-btn:hover{
  color:var(--btn-hover);
}

.topbar-btn-login{
  background-color: rgb(33, 150, 243);
  color: white;
  border: none;
  padding: 4px 16px;
  font-family: "Rubik", sans-serif;
  font-size: 16px;
  font-weight: 300;
  border-radius: 16px;
  cursor: pointer;
  transition: background-color 0.5s ease;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  margin-right: 16px;
}

.topbar-btn-login:hover{
  background-color: #2B7FCB;
}

.topbar-user-btn{
  margin-left: auto;
  padding: 4px 14px;
  height: 32px;
  border: 1px solid rgba(160, 174, 192, 0.35);
  border-radius: 16px;
  background: rgba(36, 37, 47, 0.7);
  color: #ffffff;
}

.topbar-logout-btn{
  padding: 4px 12px;
  height: 32px;
  border: none;
  border-radius: 16px;
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
  margin-right: 16px;
}

.topbar-logout-btn:hover{
  color: #fecaca;
  background: rgba(220, 38, 38, 0.32);
}

.topbar-btn-icon{
  display:flex;
  align-items:center;
  justify-content:center;
}

.logo-box{
  width:var(--logo-box-w);
  height:var(--logo-box-h);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  position:relative;
  z-index:1;
}

.logo-img{
  width:var(--logo-img-w);
  height:var(--logo-img-h);
  object-fit:contain;
}

/* layout */
.page{
  display:grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  flex:1;
  height:100%;
  min-height: 0;
}

.sidebar{
  background:var(--sidebar-bg);
  padding:8px;
  color:white;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  height:100%;
  min-height: 0;
}

.content{
  overflow:auto;
  color:#1a1c24;
  background-image:linear-gradient(rgba(26, 28, 36, 0.67), rgba(26, 28, 36, 0.67)), url('../images/background.svg');
  background-size:cover;
  background-position:center;
  background-attachment:fixed;
}

.content{
  scrollbar-width: thin;
  scrollbar-color: rgba(160, 174, 192, 0.6) transparent;
}

.content::-webkit-scrollbar{
  width:4px;
}

.content::-webkit-scrollbar-track{
  background:transparent;
}

.content::-webkit-scrollbar-thumb{
  background: rgba(160, 174, 192, 0.6);
  border-radius:4px;
}

.content::-webkit-scrollbar-thumb:hover{
  background: rgba(160, 174, 192, 0.8);
}

.main-content-bar{
  width:calc(100% - 16px);
  height:72px;
  background:#25443A;
  border-radius:4px;
  font-family:"Rubik", sans-serif;
  display:none;
  position:relative;
  margin-top:7px;
  margin-left:8px;
  margin-right:8px;
  flex-direction:column;
  justify-content:center;
  padding:8px 12px;
  gap:10px;
}

.main-content-bar::before{
  content:'';
  position:absolute;
  top:0;
  left:0;
  width:5px;
  height:100%;
  background:#5EAD7F;
  border-top-left-radius:4px;
  border-bottom-left-radius:4px;
  border-top-right-radius:0;
  border-bottom-right-radius:0;
}

.main-content-bar-top-text{
  color:#5E9881;
  font-family:"Rubik", sans-serif;
  font-size:18px;
  font-weight:300;
  line-height:0.78;
}

.main-content-bar-subtext{
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:17px;
  font-weight:300;
  line-height:0.76;
}

.main-content-sections{
  width:calc(100% - 16px);
  margin-top:8px;
  margin-left:8px;
  margin-right:8px;
  display:grid;
  grid-template-columns:repeat(4, minmax(0, 1fr));
  gap:8px;
}

.main-content-section-card{
  width:100%;
  height:72px;
  background:var(--section-bg);
  border-radius:4px;
  font-family:"Rubik", sans-serif;
}

.section-total-value-card{
  display:flex;
  flex-direction:column;
  justify-content:center;
  padding:8px;
  gap:12px;
}

.section-total-value-amount{
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:18px;
  font-weight:300;
  line-height:0.78;
}

.section-total-value-label{
  color:var(--btn-color);
  font-family:"Rubik", sans-serif;
  font-size:14px;
  font-weight:300;
  line-height:0.78;
}

.main-content-section-actions{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:108px;
  padding:0 8px;
}

.section-action-btn{
  height:32px;
  min-width:86px;
  border:none;
  border-radius:999px;
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  cursor:pointer;
  transition: background-color 0.2s ease;
}

.section-action-create{
  background-color:#4E5566;
  transition: background-color 0.2s ease;
}

.section-action-create:hover{
  background-color:#5D6578;
}

.section-action-history{
  background:#2294F8;
}

.section-action-history:hover{
  background:#2B7FCB;
}

.coinflip-list{
  width:calc(100% - 16px);
  margin:8px 8px 0 8px;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.coinflip-game-row{
  width:100%;
  min-height:80px;
  background:#232734;
  border-radius:6px;
  display:grid;
  grid-template-columns:136px minmax(180px, 3fr) minmax(88px, 1fr) minmax(140px, 1.5fr) 64px;
  align-items:center;
  column-gap:0;
  padding:0 12px 0 8px;
  box-sizing:border-box;
}

.coinflip-left-coins{
  width:136px;
  display:grid;
  grid-template-columns:64px 64px;
  gap:8px;
}

.coin-slot{
  width:64px;
  height:64px;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
}

.coin-avatar-image{
  width:64px;
  height:64px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(255,255,255,0.15);
}

.coin-avatar{
  width:64px;
  height:64px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:22px;
  font-weight:600;
  border:2px solid rgba(255,255,255,0.15);
}

.coin-avatar-orange{
  background:#f28c2f;
}

.coin-avatar-blue{
  background:#3c5ccf;
}

.coin-avatar-current-player{
  display:none;
}

.coin-avatar-current-fallback{
  display:flex;
}

.coinflip-center-zone{
  width:100%;
  max-width:950px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  justify-self:center;
  padding-left:420px;
  box-sizing:border-box;
}

.coinflip-item-track{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  min-height:32px;
}

.coinflip-mid-item{
  width:64px;
  height:64px;
  border-radius:999px;
  border:none;
  background:transparent;
  color:var(--btn-color);
  font-family:"Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  display:flex;
  align-items:center;
  justify-content:center;
  line-height:1;
  overflow:hidden;
}

.coinflip-mid-item-image{
  width:100%;
  height:100%;
  object-fit:cover;
  border-radius:999px;
}

.coinflip-mid-item-overflow{
  background:rgba(78, 85, 102, 0.9);
  color:#ffffff;
  border-color:rgba(160, 174, 192, 0.6);
}

.coinflip-size-zone{
  width:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding-left:112px;
  box-sizing:border-box;
}

.coinflip-winning-zone{
  width:100%;
  max-width:415px;
  display:flex;
  align-items:center;
  justify-content:center;
  justify-self:stretch;
}

.coinflip-winning-coin{
  width:64px;
  height:64px;
  border-radius:50%;
  object-fit:cover;
  border:2px solid rgba(255,255,255,0.15);
}

.coinflip-value-block{
  text-align:center;
  min-width:88px;
  height:80px;
  position:relative;
  --coinflip-size-edge-offset: 18px;
}

.coinflip-value-main{
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  line-height:0.75;
  position:absolute;
  top:var(--coinflip-size-edge-offset);
  left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
}

.coinflip-value-sub{
  color:var(--btn-color);
  font-family:"Rubik", sans-serif;
  font-size:14px;
  font-weight:300;
  line-height:0.72;
  position:absolute;
  bottom:var(--coinflip-size-edge-offset);
  left:50%;
  transform:translateX(-50%);
  white-space:nowrap;
}

.coinflip-actions{
  display:flex;
  flex-direction:column;
  gap:4px;
  margin-left:0;
}

.coinflip-action-btn{
  height:32px;
  width:64px;
  border:none;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#ffffff;
  font-family:"Rubik", sans-serif;
  font-size:16px;
  font-weight:300;
  cursor:pointer;
  transition: background-color 0.2s ease;
}

.coinflip-join-btn{
  background:#2294F8;
}

.coinflip-join-btn:hover{
  background:#2B7FCB;
}

.coinflip-view-btn{
  background-color:#4E5566;
  transition: background-color 0.2s ease;
}

.coinflip-view-btn:hover{
  background-color:#5D6578;
}

/* chat */
.chat-container{
  display:flex;
  flex-direction:column;
  height:100%;
}

.chat-header{
  height:35px;
  display:flex;
  align-items:center;
  padding:0 12px;
  font-weight: 300;
  font-family: "Rubik", sans-serif;
  font-size: 16px;
  color: var(--btn-color);
  background-color: var(--topbar-bg);
  width: 241px;
  border-radius: 4px;
  margin: 8px 8px 8px 8px;
  flex-shrink: 0;
}

.chat-header .title{
  margin-top:-3px;
  text-align:left;
}

.messages{
  flex: 1;
  max-height: calc(100% - 35px - 80px - 48px);
  overflow-y: auto;
  padding:4px 5px;
  display:flex;
  flex-direction:column;
  gap:3px;
  scrollbar-gutter: stable;
  min-height: 0;
}
.messages::-webkit-scrollbar {
  width: 4px;
}

.messages::-webkit-scrollbar-track {
  background: transparent;
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(160, 174, 192, 0.6);
  border-radius: 4px;
}

.messages::-webkit-scrollbar-thumb:hover {
  background: rgba(160, 174, 192, 0.8);
}

.message{
  display:flex;
  flex-direction:column;
  gap:1px;
  padding:4px 0;
  color:var(--muted);
  font-size:12px;
}

.message-header{
  display:flex;
  align-items:center;
  gap:6px;
}

.message-avatar{
  width:32px;
  height:32px;
  min-width:32px;
  background:#4a5568;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:11px;
  color:white;
}

.message-username{
  color:white;
  font-weight:600;
  font-size:14px;
  margin-top:-4px;
}

.message-content{
  display:flex;
  flex-direction:column;
  gap:2px;
  flex:1;
  margin-top:-5px;
}

.message-text{
  color:var(--muted);
  font-size:15px;
  line-height:1.15;
}

.chat-input{
  padding:8px 0;
  display:flex;
  flex-direction:column;
  gap:8px;
  flex-shrink: 0;
  height: 80px;
  margin: 0 4px 8px 4px;
}

.chat-input input{
  padding:8px;
  background:#0b0b0c;
  color:white;
  border-radius:6px;
  border:1px solid rgba(255,255,255,0.04);
}

.chat-input button{
  padding:8px;
  background-color:#4a5568;
  border:0;
  border-radius:6px;
  color:white;
  font-weight:500;
  transition: background-color 0.18s ease;
  will-change: background-color;
  transform: translateZ(0);
  backface-visibility: hidden;
  contain: paint;
  cursor:pointer;
}

.chat-input button:hover{
  background-color:#5a6578;
}

.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid #2196f3;
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}
