/* Steam Game Night — clean light UI (v2) */

:root {
  --bg: #fbfbfd;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --surface-3: #ececef;
  --border: #e5e5ea;
  --border-strong: #d1d1d6;
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-faint: #8e8e93;
  --accent: #0071e3;
  --accent-hover: #0066cc;
  --accent-soft: #66c0f4;
  --steam: #171a21;
  --steam-accent: #66c0f4;
  --accent-fire: #ff6b35;
  --accent-like: #2ea043;
  --accent-nope: #c4302b;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --container: 1180px;
  --gap: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* ----------------- header / nav ----------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.012em;
  font-size: 16px;
  color: var(--text);
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--steam);
  color: var(--steam-accent);
}

.brand-name {
  letter-spacing: -0.018em;
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.primary-nav a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: background 0.15s, color 0.15s;
}

.primary-nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.primary-nav a.active {
  color: var(--text);
  background: var(--surface-2);
}

.primary-nav .nav-spacer {
  width: 10px;
}

.me-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  color: var(--text);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: -0.005em;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.me-button:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}

.me-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-3) no-repeat center/cover;
  background-size: cover;
}

.me-avatar.has-image {
  background: var(--surface-3);
}

.logout-btn {
  padding: 7px 12px;
}

/* bottom nav (mobile) */
.bottom-nav {
  display: none;
}

/* ----------------- layout ----------------- */

.view {
  max-width: var(--container);
  margin: 0 auto;
  padding: 36px 28px 80px;
}

.page {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.page-center {
  max-width: 460px;
  margin: 8vh auto;
  text-align: center;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page h1 {
  font-size: 32px;
  margin: 0 0 6px;
  letter-spacing: -0.025em;
  font-weight: 700;
  line-height: 1.15;
}

.lead {
  color: var(--text-muted);
  margin: 0;
  max-width: 60ch;
  font-size: 15px;
}

.block {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.block-head {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.block h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.block-meta {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.empty {
  color: var(--text-muted);
  padding: 28px 18px;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: 14px;
}

.back-link {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--text);
}

.fineprint {
  color: var(--text-faint);
  font-size: 12px;
  margin: 16px auto 0;
  max-width: 320px;
}

/* ----------------- cards ----------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-xs);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

label.grow {
  flex: 1;
  min-width: 200px;
}

label.grow.wider {
  flex: 2;
}

input[type="text"],
input[type="password"],
input[type="search"],
select {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
  font-size: 14px;
  letter-spacing: -0.005em;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

input::placeholder {
  color: var(--text-faint);
}

.form-error {
  color: var(--accent-nope);
  margin: 0;
  font-size: 13px;
  min-height: 1em;
  font-weight: 500;
}

/* buttons */

.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
.btn-steam {
  appearance: none;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
  transition: transform 0.05s, box-shadow 0.15s, background 0.15s,
    border-color 0.15s, color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-3);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 12px;
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: transparent;
  color: var(--accent-nope);
  border-color: transparent;
  padding: 6px 10px;
  font-size: 13px;
}

.btn-danger:hover {
  background: rgba(196, 48, 43, 0.08);
}

.btn-steam {
  background: var(--steam);
  color: #fff;
  border-color: var(--steam);
  padding: 13px 22px;
  width: 100%;
  font-size: 15px;
  margin-top: 24px;
  box-shadow: 0 4px 14px rgba(23, 26, 33, 0.15);
}

.btn-steam:hover {
  background: #232932;
  border-color: #232932;
  transform: translateY(-1px);
}

.btn-steam:active {
  transform: translateY(0);
}

/* ----------------- login page ----------------- */

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 56px 40px 40px;
  box-shadow: var(--shadow-md);
  text-align: center;
}

.login-card h1 {
  margin: 20px 0 4px;
}

.login-card .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

/* ----------------- create group ----------------- */

.create-group {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.create-group label {
  min-width: 220px;
}

.create-group button {
  height: 45px;
}

/* ----------------- groups list ----------------- */

.group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.group-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
}

.group-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.gc-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.gc-name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.012em;
  
  text-overflow: ellipsis;
  overflow: hidden;
}

.gc-desc {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  
  text-overflow: ellipsis;
  overflow: hidden;
}

.gc-time {
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ----------------- profile grid (members) ----------------- */

.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s;
}

.profile-card:hover {
  border-color: var(--border-strong);
}

.profile-card .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
}

.profile-card .avatar.fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--surface-3);
  text-transform: uppercase;
}

.profile-card .who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.profile-card .persona {
  font-weight: 600;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 15px;
  line-height: 1.3;
}

.profile-card .meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-card .controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.icon-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ----------------- add member ----------------- */

.add-member {
  flex-direction: row;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.add-member label {
  flex: 1;
  min-width: 240px;
}

.add-member button {
  height: 45px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ----------------- game grid ----------------- */

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}

.game-grid.wide {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.game-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: var(--shadow-xs);
}

.game-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.game-card .header-img {
  position: relative;
  width: 100%;
  aspect-ratio: 460 / 215;
  background: linear-gradient(135deg, #b8c4d4 0%, #6b7c93 100%);
  overflow: hidden;
}

.game-card .header-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.game-card .badges {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  backdrop-filter: blur(4px);
}

.badge.recent {
  background: rgba(46, 160, 67, 0.9);
}

.badge.owned {
  background: rgba(23, 26, 33, 0.78);
}

.badge.wishlist {
  background: rgba(0, 113, 227, 0.85);
}

.game-card .body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-card .title {
  font-weight: 600;
  font-size: 14px;
  margin: 0;
  line-height: 1.35;
  letter-spacing: -0.005em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card .vote-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  margin-top: 2px;
}

.vote-btn {
  appearance: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s,
    transform 0.05s;
}

.vote-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

.vote-btn:active {
  transform: scale(0.96);
}

.vote-btn .cnt {
  font-size: 11px;
  font-weight: 700;
  color: inherit;
}

.vote-btn.active.fire {
  background: rgba(255, 107, 53, 0.16);
  border-color: var(--accent-fire);
  color: var(--accent-fire);
}

.vote-btn.active.like {
  background: rgba(46, 160, 67, 0.16);
  border-color: var(--accent-like);
  color: var(--accent-like);
}

.vote-btn.active.nope {
  background: rgba(196, 48, 43, 0.16);
  border-color: var(--accent-nope);
  color: var(--accent-nope);
}

.game-card .score {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.game-card .score strong {
  font-size: 18px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* ----------------- filter bar ----------------- */

.filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  flex: 1;
  margin-left: auto;
  justify-content: flex-end;
}

.filter-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.filter-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-btn.active:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.search {
  min-width: 200px;
  max-width: 240px;
  padding: 8px 14px;
  font-size: 13px;
}

/* ----------------- session status / picker ----------------- */

.session-status {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

.session-status.active {
  border-left-color: var(--accent-like);
}

.session-status.closed {
  border-left-color: var(--text-muted);
}

.session-status strong {
  color: var(--text);
}

.session-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.session-picker {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.picker-label {
  flex: 1;
  min-width: 180px;
}

.picker-label select {
  margin-top: 2px;
  text-transform: none;
  letter-spacing: -0.005em;
  font-size: 14px;
  color: var(--text);
}

/* ----------------- session list ----------------- */

.session-list {
  display: grid;
  gap: 10px;
}

.session-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-xs);
}

.session-row .session-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.session-row .session-id strong {
  font-weight: 600;
  letter-spacing: -0.005em;
}

.session-row .id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-muted);
}

.session-row .meta {
  font-size: 12px;
  color: var(--text-muted);
}

.session-row .status-pill {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.status-pill.active {
  background: rgba(46, 160, 67, 0.14);
  color: var(--accent-like);
}

.status-pill.closed {
  background: rgba(110, 110, 115, 0.14);
  color: var(--text-muted);
}

/* ----------------- podium ----------------- */

.podium {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.podium-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-xs);
}

.podium-card.winner {
  border-color: #f0c674;
  background: linear-gradient(180deg, #fff7e0 0%, #ffffff 100%);
  box-shadow: 0 8px 28px rgba(240, 198, 116, 0.25);
}

.podium-card .rank {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.podium-card.winner .rank {
  color: #b07d2f;
}

.podium-card .name {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
}

.podium-card .score {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.bar-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}

.bar-track {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  display: block;
}

.bar-fill.fire {
  background: var(--accent-fire);
}
.bar-fill.like {
  background: var(--accent-like);
}
.bar-fill.nope {
  background: var(--accent-nope);
}

/* ----------------- responsive ----------------- */

@media (max-width: 720px) {
  .view {
    padding: 24px 16px 96px;
  }
  .app-header {
    padding: 12px 16px;
  }
  .primary-nav {
    display: none;
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0));
    justify-content: space-around;
  }
  .bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 500;
    border-radius: 12px;
    transition: color 0.15s, background 0.15s;
  }
  .bottom-nav a:hover,
  .bottom-nav a.active {
    color: var(--accent);
    background: transparent;
  }
  .bn-icon {
    font-size: 20px;
    line-height: 1;
  }
  .page h1 {
    font-size: 26px;
  }
  .filter-bar {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .create-group,
  .add-member {
    flex-direction: column;
    align-items: stretch;
  }
  .add-profile .meta {
    display: none;
  }
  .game-card .header-img {
    aspect-ratio: 460 / 215;
  }
}
