* { box-sizing: border-box; }
body.dark-body { margin: 0; font-family: Arial, sans-serif; background: #0a0a0f; color: #e5e7eb; }
.container { width: min(1100px, 94%); margin: 20px auto; }
.center-wrap { width: min(460px, 94%); margin: 10vh auto; background: #111827; padding: 24px; border-radius: 12px; border: 1px solid #1f2937; }
.top-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.top-bar h1 { margin: 0; font-size: 1.25rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.card-link { text-decoration: none; color: inherit; }
.card { background: #111827; border: 1px solid #1f2937; border-radius: 10px; padding: 14px; }
.btn-primary, .btn-outline, button { min-height: 44px; padding: 10px 14px; border-radius: 8px; border: 0; cursor: pointer; }
.btn-primary, button { background: #dc2626; color: #fff; }
.btn-outline { border: 1px solid #3b82f6; color: #3b82f6; text-decoration: none; display: inline-flex; align-items: center; }
.badge { padding: 4px 8px; border-radius: 999px; font-size: 12px; }
.badge-active { background: #dc2626; color: #fff; }
.badge-pending { background: #374151; color: #fff; }
.badge-completed { background: #10b981; color: #fff; }
.error-box { background: #7f1d1d; color: #fecaca; padding: 10px; border-radius: 8px; margin-bottom: 10px; }
.widget-box { margin-top: 14px; }

/* ===== SITE HEADER ===== */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: #0d0d14;
  border-bottom: 1px solid #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 500;
}

.hamburger {
  width: 36px; height: 36px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; cursor: pointer;
  border: none; background: transparent;
  border-radius: 8px;
  transition: background 0.2s;
  flex-shrink: 0;
  padding: 0;
}
.hamburger:hover { background: #1f2937; }
.hamburger span {
  display: block; width: 20px; height: 1.5px;
  background: #9ca3af; border-radius: 2px;
  transition: all 0.3s;
}
.hamburger.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

.header-logo {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  pointer-events: none;
}
.logo-placeholder {
  width: 32px; height: 32px; border-radius: 8px;
  background: #1a0505; border: 1px solid #7f1d1d;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.logo-text {
  font-size: 15px; font-weight: 700; color: #e5e7eb;
  letter-spacing: 0.04em;
}

.header-user {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: #1f2937; border: 1px solid #374151;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #9ca3af;
  flex-shrink: 0;
}
.user-name {
  font-size: 12px; font-weight: 500; color: #9ca3af;
  max-width: 100px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

/* DRAWER */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
  z-index: 600;
}
.drawer-overlay.open { opacity: 1; pointer-events: all; }

.drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 240px;
  background: #0d0d14;
  border-right: 1px solid #1a1a2e;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  z-index: 700;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  height: 56px; display: flex; align-items: center;
  padding: 0 16px; border-bottom: 1px solid #1a1a2e;
  gap: 10px; flex-shrink: 0;
}
.drawer-logo-text { font-size: 14px; font-weight: 700; color: #e5e7eb; }

.drawer-nav {
  flex: 1; padding: 12px 8px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: #9ca3af;
  cursor: pointer; transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.drawer-item:hover { background: #111827; color: #e5e7eb; }
.drawer-item svg { flex-shrink: 0; opacity: 0.6; }
.drawer-item:hover svg { opacity: 1; }
.drawer-item.logout { color: #ef4444; }
.drawer-item.logout:hover { background: #1a0505; color: #fca5a5; }

.drawer-footer {
  padding: 12px 8px;
  border-top: 1px solid #1a1a2e;
  flex-shrink: 0;
}

/* Page body offset for fixed header */
.has-header {
  padding-top: 56px;
}

/* ===== HOME PAGE ===== */
.home-wrap {
  padding: 16px 14px 32px;
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-message {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 4px;
}
.home-message.success { background: #052e16; border: 1px solid #14532d; color: #4ade80; }
.home-message.error   { background: #1a0505; border: 1px solid #7f1d1d; color: #fca5a5; }

.home-section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.15em; text-transform: uppercase;
  color: #4b5563;
  padding: 4px 2px;
  margin-top: 4px;
}
.section-dot {
  width: 6px; height: 6px; border-radius: 50%;
}
.active-dot  { background: #dc2626; animation: blink 1.2s ease-in-out infinite; }
.pending-dot { background: #fbbf24; }
.done-dot    { background: #374151; }

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Tournament card */
.t-card {
  background: #0d0d14;
  border: 1px solid #1a1a2e;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.t-card:hover { border-color: #374151; }
.t-card.is-active { border-color: #7f1d1d; }
.t-card.is-active:hover { border-color: #dc2626; }
.t-card.is-completed { opacity: 1; }
.t-card.is-completed .t-card-main { opacity: 0.88; }

.t-card-main {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.t-card-info { flex: 1; min-width: 0; }
.t-card-name {
  font-size: 14px; font-weight: 600; color: #e5e7eb;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-bottom: 6px;
}
.t-card-meta {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.t-meta-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: #4b5563;
}
.t-meta-item svg { opacity: 0.5; }
.t-joined-badge {
  font-size: 10px; font-weight: 700;
  color: #4ade80; background: #052e16;
  border: 1px solid #14532d;
  padding: 2px 8px; border-radius: 10px;
  letter-spacing: 0.05em;
}

.t-card-right { flex-shrink: 0; }

.t-status-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: 10px; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  letter-spacing: 0.08em;
}
.t-status-badge.active  { background: #1a0505; border: 1px solid #dc2626; color: #dc2626; }
.t-status-badge.drawing { background: #1c1407; border: 1px solid #92400e; color: #fbbf24; }
.t-status-badge.pending { background: #0a1628; border: 1px solid #1e3a5f; color: #60a5fa; }
.t-status-badge.completed { background: #052e16; border: 1px solid #14532d; color: #4ade80; }

.status-live-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: #dc2626;
  animation: blink 1.2s ease-in-out infinite;
}

.t-card-actions {
  display: flex; align-items: stretch;
  gap: 8px;
  padding: 0 16px 14px;
  width: 100%;
  box-sizing: border-box;
}
.t-card-actions--dual {
  flex-wrap: nowrap;
}

.t-btn-view {
  display: inline-flex; align-items: center; gap: 4px;
  background: #111827; border: 1px solid #1f2937;
  border-radius: 8px; color: #9ca3af;
  font-size: 12px; font-weight: 600;
  padding: 7px 14px; text-decoration: none;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}
.t-btn-view:hover { background: #1f2937; color: #e5e7eb; }
.t-card.is-active .t-btn-view {
  background: #1a0505; border-color: #dc2626; color: #dc2626;
}
.t-card.is-active .t-btn-view:hover { background: #dc2626; color: #fff; }

.t-card-actions--dual .t-btn-view.t-btn-view-split {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  min-height: 40px;
}

/* <a> için :link/:visited tarayıcı stili (mavi + alt çizgi) ezilmesin diye tam seçici */
.t-card-actions--dual a.t-btn-replay,
.t-card-actions--dual a.t-btn-replay:link,
.t-card-actions--dual a.t-btn-replay:visited,
.t-card-actions--dual a.t-btn-replay:active {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  margin: 0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  -webkit-text-decoration: none;
  text-decoration-line: none;
  color: #c7d2fe;
  background: #111827;
  border: 1px solid #4338ca;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.t-card-actions--dual a.t-btn-replay:hover {
  background: #1e1b4b;
  border-color: #6366f1;
  color: #e0e7ff;
}
.t-card-actions--dual a.t-btn-replay:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}
.t-card-actions--dual a.t-btn-replay svg {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.t-btn-join {
  width: 100%;
  background: #dc2626; border: none;
  border-radius: 8px; color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 7px 14px; cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.t-btn-join:hover { background: #b91c1c; }

/* Empty state */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; gap: 8px;
}
.empty-icon { font-size: 40px; margin-bottom: 8px; }
.empty-title { font-size: 16px; font-weight: 600; color: #9ca3af; }
.empty-sub   { font-size: 13px; color: #374151; }
