/* PaperDot — shared styles */

:root {
  --paper: #f6f1e7;
  --paper-dark: #ebe3d4;
  --ink: #2c2824;
  --ink-muted: #6b635a;
  --accent: #3d6b5e;
  --accent-hover: #2f5549;
  --accent-soft: #d8e8e2;
  --card: #fffcf7;
  --border: #ddd4c4;
  --input-bg: #fff;
  --dot-grid: #c9bfb0;
  --overlay: rgba(44, 40, 36, 0.45);
  --shadow: 0 2px 12px rgba(44, 40, 36, 0.08);
  --shadow-hover: 0 8px 24px rgba(44, 40, 36, 0.12);
  --header-height: 4rem;
  --max-width: 52rem;
  --radius: 0.75rem;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #171513;
  --paper-dark: #24201d;
  --ink: #f2ece4;
  --ink-muted: #a69e94;
  --accent: #6db5a3;
  --accent-hover: #5aa090;
  --accent-soft: #243832;
  --card: #201d1a;
  --border: #3a3530;
  --input-bg: #2a2622;
  --dot-grid: #2f2a26;
  --overlay: rgba(0, 0, 0, 0.62);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(circle, var(--dot-grid) 1px, transparent 1px);
  background-size: 1.25rem 1.25rem;
  background-position: 0 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* Header — OtterRoster-style bar */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 72rem;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-logo {
  display: flex;
  align-items: center;
  line-height: 0;
}

.site-logo:hover {
  opacity: 0.88;
}

.site-logo__img {
  display: block;
  height: 2.25rem;
  width: auto;
}

.site-logo__img--dark {
  display: none;
}

[data-theme="dark"] .site-logo__img--light {
  display: none;
}

[data-theme="dark"] .site-logo__img--dark {
  display: block;
}

.site-logo__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 1.1rem;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav__link {
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-muted);
  border-radius: 999px;
  transition: background 0.15s, color 0.15s;
}

.site-nav__link:hover {
  color: var(--ink);
  background: var(--paper-dark);
}

.site-nav__link--active {
  color: var(--accent);
  background: var(--accent-soft);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  font: inherit;
  color: var(--ink-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
  color: var(--ink);
  background: var(--paper-dark);
}

.theme-toggle__icon {
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle__icon--moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__icon--moon {
  display: block;
}

/* Layout */

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.page--narrow {
  max-width: 36rem;
  text-align: center;
}

/* Intro */

.intro {
  margin-bottom: 2.5rem;
}

.intro__title {
  margin: 0 0 0.75rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.intro__text {
  margin: 0;
  max-width: 38ch;
  font-size: 1.05rem;
  color: var(--ink-muted);
}

/* Game grid */

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 9rem;
  padding: 1.25rem 1.35rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.game-card__icon {
  margin-bottom: 0.75rem;
  font-size: 1.75rem;
  line-height: 1;
}

.game-card__name {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.2rem;
  font-weight: 600;
}

.game-card__desc {
  margin: 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

/* Footer */

.site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--ink-muted);
}

.site-footer a:hover {
  color: var(--ink);
}

.legal-doc {
  max-width: 40rem;
}

.legal-doc h1 {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.75rem, 4vw, 2.1rem);
}

.legal-doc__updated {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.legal-doc h2 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1.05rem;
}

.legal-doc p,
.legal-doc li {
  line-height: 1.6;
  color: var(--ink-muted);
}

.legal-doc ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.legal-doc strong {
  color: var(--ink);
}

.site-footer__kofi {
  display: inline-block;
  margin-top: 0.65rem;
  line-height: 0;
}

.site-footer__kofi img {
  display: block;
  height: 2.25rem;
  width: auto;
  border-radius: 999px;
  transition: opacity 0.15s, transform 0.15s;
}

.site-footer__kofi:hover img {
  opacity: 0.92;
  transform: translateY(-1px);
}

/* Placeholder / coming-soon pages */

.coming-soon {
  margin-top: 2rem;
  padding: 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.coming-soon__title {
  margin: 0 0 0.5rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
}

.coming-soon__text {
  margin: 0 0 1.25rem;
  color: var(--ink-muted);
}

.btn {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn--ghost {
  color: var(--accent);
  background: transparent;
  border: 1.5px solid var(--accent);
}

.btn--ghost:hover {
  color: #fff;
  background: var(--accent);
}

/* Auth gate */

.auth-gate.setup-card {
  max-width: 28rem;
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: left;
}

.auth-gate.setup-card h1 {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.5rem;
}

.auth-gate.setup-card p {
  margin: 0 0 1rem;
  color: var(--ink-muted);
}

.auth-gate__actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.auth-gate__google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
}

.auth-gate__google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  font-weight: 700;
  font-size: 0.85rem;
  background: #fff;
  color: #4285f4;
  border-radius: 50%;
}

.auth-gate__note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.status-banner {
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  color: var(--ink-muted);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.status-banner--error {
  color: #8b2f2f;
  background: #fdeeee;
  border-color: #e8bcbc;
}

[data-theme="dark"] .status-banner--error {
  color: #f5b8b8;
  background: #3a2222;
  border-color: #6b4040;
}

.field__hint {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

/* Profile */

.page--profile {
  max-width: 56rem;
  padding: 2.25rem 1.25rem 4rem;
}

.profile-page {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 0.25rem;
}

.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 4.75rem;
  height: 4.75rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  border: 3px solid var(--card);
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.profile-hero__name {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.65rem, 4vw, 2rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.profile-hero__meta {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-muted);
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.profile-card {
  padding: 1.85rem 1.9rem 2rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.profile-card--history {
  min-height: 16rem;
}

.profile-card__title {
  margin: 0 0 0.4rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
}

.profile-card__lead {
  margin: 0 0 1.65rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--ink-muted);
}

.profile-form .field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.65rem;
}

.profile-form .field:last-of-type {
  margin-bottom: 0;
}

.profile-form .field label {
  font-size: 0.85rem;
  font-weight: 600;
}

.profile-form .field__hint {
  margin: -0.1rem 0 0.35rem;
  line-height: 1.45;
}

.profile-form .field input[type="text"] {
  padding: 0.7rem 0.9rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  background: var(--input-bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.profile-form .field input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.profile-color-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.55rem;
  max-width: 15rem;
  margin-top: 0.15rem;
}

.profile-color-option {
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.profile-color-option:hover {
  transform: scale(1.08);
}

.profile-color-option.is-selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px var(--card);
}

.profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.85rem;
  padding-top: 1.65rem;
  border-top: 1px solid var(--border);
}

.profile-actions .btn {
  flex: 1 1 9rem;
  min-width: 0;
  padding: 0.65rem 1.15rem;
  text-align: center;
}

.profile-history {
  list-style: none;
  margin: 0.85rem 0 0;
  padding: 0;
}

.profile-history__item {
  border-bottom: 1px solid var(--border);
}

.profile-history__item:last-child {
  border-bottom: none;
}

.profile-history__link {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
  padding: 0.85rem 0.15rem;
  color: inherit;
  border-radius: 0.5rem;
  transition: background 0.12s;
}

.profile-history__link:hover {
  background: var(--paper);
}

.profile-history__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  font-size: 1.05rem;
  line-height: 1;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
}

.profile-history__body {
  min-width: 0;
}

.profile-history__game {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.profile-history__score {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.84rem;
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-history__aside {
  text-align: right;
  flex-shrink: 0;
}

.profile-history__result {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
}

.profile-history__result--won {
  color: var(--accent);
}

.profile-history__result--lost {
  color: #c45c1a;
}

.profile-history__result--draw {
  color: var(--ink-muted);
}

[data-theme="dark"] .profile-history__result--lost {
  color: #f0a050;
}

.profile-history__date {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.profile-empty {
  margin-top: 0.65rem;
  padding: 1.25rem 1rem;
  text-align: center;
  background: var(--paper);
  border: 1px dashed var(--border);
  border-radius: 0.65rem;
}

.profile-empty__title {
  margin: 0 0 0.35rem;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
}

.profile-empty__hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-muted);
}

.profile-empty__games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.profile-empty__game {
  position: relative;
  display: block;
  padding: 0.65rem 0.75rem 0.65rem 2.1rem;
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1.3;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.55rem;
  transition: border-color 0.12s, transform 0.12s;
}

.profile-empty__game:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.profile-empty__game-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  font-size: 1rem;
  line-height: 1;
  transform: translateY(-50%);
}

.profile-empty__game-label {
  display: block;
  text-align: center;
}

.profile-empty__all {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.profile-empty__all:hover {
  color: var(--accent-hover);
}

/* Toast (shared — profile & other non-game pages) */

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 300;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-history__link {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .profile-history__aside {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    text-align: left;
  }

  .profile-history__date {
    margin-top: 0;
  }
}

@media (max-width: 520px) {
  .game-grid {
    grid-template-columns: 1fr;
  }

  .intro__text {
    max-width: none;
  }
}
