﻿.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.input-group label {
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  padding: 0.95rem 1.1rem;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.input-group input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.input-grid {
  display: grid;
  gap: 0.9rem;
}

@media (min-width: 720px) {
  .input-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: rgba(79, 223, 255, 0.7);
  background: rgba(79, 223, 255, 0.12);
}

.form-card {
  width: min(480px, 100%);
  padding: clamp(1.8rem, 4vw, 2.4rem);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  backdrop-filter: blur(22px);
  background: linear-gradient(155deg, rgba(7, 21, 60, 0.8), rgba(8, 32, 78, 0.6));
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 25px 60px rgba(5, 10, 30, 0.55);
}

.form-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  text-align: center;
}

.form-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.form-actions button {
  width: 100%;
}

.auth-helper {
  display: grid;
  gap: 0.35rem;
  justify-items: start;
}

.auth-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: left;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}

.oauth-buttons {
  display: grid;
  gap: 0.6rem;
}

.oauth-button {
  width: 100%;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.oauth-button:hover {
  border-color: rgba(79, 223, 255, 0.6);
  background: rgba(79, 223, 255, 0.12);
  transform: translateY(-1px);
}

.error-banner {
  border-radius: 16px;
  border: 1px solid rgba(255, 106, 106, 0.4);
  background: rgba(255, 106, 106, 0.12);
  color: #ffdede;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  text-align: center;
}

.success-banner {
  border-radius: 16px;
  border: 1px solid rgba(0, 214, 147, 0.5);
  background: rgba(0, 214, 147, 0.12);
  color: #b4ffe8;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  text-align: center;
}

[data-auth-message],
.inline-message {
  border-radius: 16px;
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

[data-auth-message][data-variant="error"],
.inline-message[data-variant="error"] {
  border-color: rgba(255, 99, 132, 0.5);
  background: rgba(255, 99, 132, 0.12);
  color: #ffdce4;
}

[data-auth-message][data-variant="success"],
.inline-message[data-variant="success"] {
  border-color: rgba(0, 214, 147, 0.5);
  background: rgba(0, 214, 147, 0.12);
  color: #b2ffe5;
}

[data-auth-message][data-variant="warning"],
.inline-message[data-variant="warning"] {
  border-color: rgba(255, 175, 58, 0.45);
  background: rgba(255, 175, 58, 0.14);
  color: #ffe4b2;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(50px, 1fr));
  gap: clamp(0.6rem, 2.5vw, 1.1rem);
  position: relative;
}
	
	.tile-slot {
	  position: relative;
	  padding-bottom: 100%;
	  border-radius: 18px;
	  border: 1px solid rgba(255, 255, 255, 0.1);
	  background:
      radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.08), transparent 60%),
      rgba(255, 255, 255, 0.03);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.12),
      inset 0 -8px 20px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(4px);
	  overflow: hidden;
	}
	
.tile-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  border-radius: 18px;
  border: 1px solid var(--tile-border, rgba(255, 255, 255, 0.28));
  outline: 1px solid rgba(255, 255, 255, 0.08);
  outline-offset: -4px;
  font-weight: 700;
  color: var(--tile-text, #041540);
  background: var(--tile-background, #f9d76f);
  box-shadow:
    var(--tile-shadow, 0 18px 40px rgba(0, 0, 0, 0.35)),
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 -12px 28px rgba(0, 0, 0, 0.18) inset,
    0 16px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(2px);
  text-align: center;
  padding: clamp(0.5rem, 1.6vw, 0.7rem);
  line-height: 1.08;
  isolation: isolate;
  overflow: hidden;
  max-width: 100%;
  max-height: 100%;
  will-change: transform;
  --tile-x: 0px;
  --tile-y: 0px;
  transform: translate(var(--tile-x), var(--tile-y));
  transition:
    transform 0.32s cubic-bezier(0.25, 0.8, 0.3, 1),
    box-shadow 0.25s ease;
}

.tile::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.35), transparent 58%),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.28), transparent 62%);
  opacity: 0.55;
  pointer-events: none;
  mix-blend-mode: screen;
  z-index: 0;
}

.tile::before {
  content: "";
  position: absolute;
  inset: -10%;
  border-radius: inherit;
  background: var(--tile-glow, radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.2), transparent 60%));
  opacity: 0.6;
  filter: blur(16px);
  pointer-events: none;
  z-index: 0;
}

.tile > * {
  position: relative;
  z-index: 1;
}

.tile-moving-instant {
  transition: none !important;
}

.tile.just-merged {
  animation: pulse 0.5s ease;
}

.tile.tile-spawn {
  animation: tile-pop 0.28s ease;
}

.tile-symbol {
  font-size: clamp(1rem, 2.4vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tile-value {
  font-size: clamp(0.85rem, 2vw, 1.05rem);
  font-weight: 600;
}

.tile-atomic {
  font-size: clamp(0.68rem, 1.8vw, 0.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: currentColor;
  opacity: 0.75;
}

@keyframes tile-pop {
  0% {
    opacity: 0;
    transform: translate(var(--tile-x), var(--tile-y)) scale(0.5);
  }
  70% {
    opacity: 1;
    transform: translate(var(--tile-x), var(--tile-y)) scale(1.1);
  }
  100% {
    opacity: 1;
    transform: translate(var(--tile-x), var(--tile-y)) scale(1);
  }
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.toolbar button {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.toolbar button:hover {
  border-color: rgba(79, 223, 255, 0.7);
  background: rgba(79, 223, 255, 0.16);
}

.leaderboard,
.history {
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 1.8vw, 1.6rem);
}

.leaderboard table,
.history-list {
  width: 100%;
  border-collapse: separate;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.leaderboard th,
.leaderboard td {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.85rem;
}

.leaderboard thead {
  color: var(--text-muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.leaderboard table {
  border-spacing: 0 clamp(0.35rem, 1vw, 0.6rem);
}

.leaderboard tbody tr {
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease;
}

.leaderboard tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.04);
}

.leaderboard tbody tr:hover {
  background: rgba(79, 223, 255, 0.08);
}

.leaderboard tbody tr[data-clickable="true"] {
  cursor: pointer;
}

.leaderboard tbody tr[data-clickable="true"]:focus-visible {
  outline: 2px solid rgba(79, 223, 255, 0.8);
  outline-offset: 2px;
}

.leaderboard tbody td:first-child {
  border-top-left-radius: 14px;
  border-bottom-left-radius: 14px;
}

.leaderboard tbody td:last-child {
  border-top-right-radius: 14px;
  border-bottom-right-radius: 14px;
}

.leader-preview {
  position: relative;
  margin-top: clamp(1.6rem, 2.5vw, 2.6rem);
  padding: clamp(1.5rem, 2.5vw, 2.2rem);
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 15, 36, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(32px);
}

.leader-preview__close {
  position: absolute;
  top: 0.6rem;
  right: 0.8rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease;
}

.leader-preview__close:hover,
.leader-preview__close:focus-visible {
  color: rgba(255, 255, 255, 0.95);
}

.leader-preview__status {
  margin: 0 2.4rem 0.4rem 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.leader-preview__status[data-variant="warning"] {
  color: #ffc27a;
}

.leader-preview__status[data-variant="success"] {
  color: #8deed1;
}

.leader-preview__content {
  display: flex;
  flex-direction: column;
  gap: clamp(1.2rem, 2vw, 1.8rem);
}

.leader-preview__header {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.leader-preview__avatar {
  width: 72px;
  height: 72px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
}

.leader-preview__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.leader-preview__label {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.leader-preview__name {
  font-size: 1.45rem;
  margin: 0.15rem 0;
}

.leader-preview__subtitle {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.leader-preview__stats {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: clamp(0.8rem, 1.4vw, 1.5rem);
}

.leader-preview__stats dt {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.leader-preview__stats dd {
  margin: 0.35rem 0 0;
  font-size: 1.15rem;
}

.leader-preview__bio {
  margin: 0;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
}

.leader-preview__notice {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-item {
  padding: 0.8rem 1rem;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.segment {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
}

.segment-title {
  font-size: 0.95rem;
  margin: 0;
}

.segment-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}
