/* Modern layout v3: Big header + horizontal contest nav (no sidebar) */
:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
  --shadow:0 10px 30px rgba(15,23,42,.10);

  --brand:#2563eb;
  --brand2:#0ea5e9;
  --danger:#dc2626;

  --hdr-pad:18px;
  --content-pad:18px;
}

html,body{ background:var(--bg) !important; }
body{
  margin:0; padding:0;
  background-image:none !important;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
  color:var(--text);
}
a{ color:inherit; }
a:hover{ text-decoration:none; }

#container{ width:100%; }
#wrapper{
  position:static !important;
  width:100%;
}
#nav,#extra{ display:none !important; }
#content{
  margin:0 !important;
  padding:var(--content-pad) var(--content-pad) 28px var(--content-pad);
  border-left:none !important;
}

#content img,
#imgdiv img{
  max-width:100%;
  width:100%;
  height:auto;
  display:block;
}
#imgdiv{
  max-width: 980px;
  margin: 0 auto;
}

/* Header */
#header{
  position:sticky;
  top:0;
  z-index:50;
  background:var(--panel);
  border-bottom:1px solid var(--border);
}

/* Big header row */
.hdr-wrap{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding: var(--hdr-pad);
}

.brand{
  display:flex;
  align-items:center;
  gap:18px;
  text-decoration:none !important;
  color:inherit !important;
}
.brand-logo{
  width:96px;
  height:96px;
  object-fit:contain;
  border-radius:24px;
  background:#fff;
  box-shadow:var(--shadow);
}
.brand-title{
  font-weight:900;
  font-size:44px;
  line-height:1.05;
  letter-spacing:.2px;
}
.brand-subtitle{
  margin-top:6px;
  font-weight:700;
  font-size:18px;
  color:var(--muted);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 64vw;
}
.brand-dot{ color:var(--brand); font-weight:900; }

.hdr-right{
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.static-links{ display:flex; gap:10px; flex-wrap:wrap; }

/* Pills */
.pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  font-weight:900;
  text-decoration:none !important;
  color:#f59e0b;
}
.pill:hover{ border-color:#d1d5db; }
.pill-primary{
  background:linear-gradient(135deg,var(--brand2),var(--brand));
  border-color:transparent;
  color:#fff;
}

/* Account dropdown */
.dropdown{ position:relative; display:inline-block; }
.btn{
  appearance:none;
  border:1px solid var(--border);
  background:#fff;
  border-radius:14px;
  padding:10px 14px;
  font-weight:900;
  cursor:pointer;
  text-decoration:none !important;
  display:inline-flex;
  align-items:center;
  gap:10px;
}
.btn-primary{
  background:linear-gradient(135deg,var(--brand2),var(--brand));
  border-color:transparent;
  color:#fff;
}
.avatar{
  width:26px;
  height:26px;
  border-radius:999px;
  background:rgba(255,255,255,.25);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
}
.nick{
  max-width:160px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.badge{
  background:#fff;
  color:var(--brand);
  font-weight:900;
  border-radius:999px;
  padding:2px 8px;
  font-size:12px;
}
.chev{ opacity:.9; }

.dropdown:focus-within .menu,
.dropdown:hover .menu{ display:block; }
.menu{
  display:none;
  position:absolute;
  right:0;
  top:calc(100% + 10px);
  min-width:240px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:8px;
  z-index:100;
}
.menu-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 10px;
  border-radius:12px;
  font-weight:900;
  text-decoration:none !important;
  color:var(--text) !important;
}
.menu-item:hover{ background:#f3f4f6; }
.menu-item.danger{ color:var(--danger) !important; }
.menu-hint{ color:var(--muted); font-size:12px; font-weight:800; }
.menu-sep{ height:1px; background:var(--border); margin:6px 4px; }

.auth-actions{ display:flex; gap:10px; flex-wrap:wrap; }

/* Contest bar */
.contestbar{ border-top:1px solid var(--border); background:#fff; }
.contestbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding: 12px var(--hdr-pad);
}
.contest-tabs{ display:flex; gap:12px; flex-wrap:wrap; }
.tab{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 180px;
  padding: 12px 16px;
  border:1px solid var(--brand);
  border-radius:12px;
  background:#fff;
  font-weight:900;
  color:#f59e0b;
  text-decoration:none !important;
}
.tab:hover{ background:#f8fafc; }
.tab.is-disabled{
  opacity:.55;
  cursor:not-allowed;
  pointer-events:none;
}
.contest-right{ display:flex; align-items:center; gap:12px; }
.timerpill{
  display:inline-flex;
  align-items:center;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:999px;
  background:#fff;
  font-weight:900;
  color:var(--text);
  white-space:nowrap;
}
.leavebtn{
  width:46px;
  height:46px;
  border-radius:14px;
  border:1px solid var(--border);
  background:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  text-decoration:none !important;
  color:var(--danger);
}
.leavebtn:hover{ border-color:#d1d5db; background:#fff5f5; }

/* Light polish */
table.t, table.stand{
  background:#fff;
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 2px 10px rgba(15,23,42,.04);
}

@media (max-width: 980px){
  .brand-logo{ width:64px; height:64px; border-radius:18px; }
  .brand-title{ font-size:28px; }
  .brand-subtitle{ font-size:14px; max-width: 70vw; }
  .hdr-wrap{ padding: 12px 12px; gap:12px; }
  .contestbar-inner{ padding: 10px 12px; }
  .tab{ min-width: 140px; padding:10px 12px; }
  #imgdiv{ max-width: 100%; }
}

@media (max-width: 640px){
  .hdr-wrap{ flex-direction:column; align-items:flex-start; }
  .hdr-right{ width:100%; justify-content:flex-start; }
  .contestbar-inner{ flex-direction:column; align-items:flex-start; }
  .contest-tabs{ width:100%; }
  .tab{ min-width: 0; flex: 1 1 auto; }
}

body.guest #content{ padding-top: 26px; }
