/*
 * Pineapple OFC Poker — Casino Card Room Theme
 * Refined dark aesthetic with serif headlines and monospace data
 * Optimized for iPhone/iPad gameplay
 */

/* ═══════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Core palette */
  --felt: #0c0c0c;
  --felt-dark: #080808;
  --felt-light: #141414;
  --felt-raised: #1a1a1a;

  /* Ivory/cream tones */
  --ivory: #f5f0e8;
  --ivory-dim: #a8a298;
  --ivory-muted: #6b665c;

  /* Accent colors */
  --gold: #d4a853;
  --gold-dim: #a68942;
  --gold-bright: #f0c866;

  --emerald: #2d8a5e;
  --emerald-dim: #1f6344;
  --emerald-bright: #3cb371;

  --ruby: #c23b3b;
  --ruby-dim: #8b2a2a;
  --ruby-bright: #e05555;

  --amethyst: #8b5fbf;
  --amethyst-dim: #6b4699;
  --amethyst-bright: #a77dd4;

  /* Borders and surfaces */
  --border-subtle: rgba(245, 240, 232, 0.06);
  --border-medium: rgba(245, 240, 232, 0.12);
  --border-strong: rgba(245, 240, 232, 0.2);

  --surface-glass: rgba(20, 20, 20, 0.85);
  --surface-raised: rgba(26, 26, 26, 0.95);

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', 'SF Mono', Monaco, 'Cascadia Mono', monospace;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;

  /* Card dimensions - larger on mobile for touch */
  --card-width: 3rem;
  --card-height: 4.2rem;
  --card-width-lg: 3.5rem;
  --card-height-lg: 4.9rem;
  --card-radius: 4px;

  /* Safe area for iPhone notch */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* Larger cards on tablets */
@media (min-width: 768px) {
  :root {
    --card-width: 3.25rem;
    --card-height: 4.55rem;
    --card-width-lg: 4rem;
    --card-height-lg: 5.6rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BASE STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  scroll-behavior: smooth;
  background: var(--felt);
}

body {
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  background: var(--felt);
  color: var(--ivory);
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}

/* Subtle noise texture overlay */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Selection */
::selection {
  background-color: rgba(212, 168, 83, 0.3);
  color: inherit;
}

/* Focus states */
*:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════════════════════════════════════ */

/* Display/headline font */
.font-display,
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Monospace */
.font-mono, code, pre {
  font-family: var(--font-mono);
}

/* Color utility classes */
.text-ivory { color: var(--ivory); }
.text-ivory-dim { color: var(--ivory-dim); }
.text-ivory-muted { color: var(--ivory-muted); }
.text-gold { color: var(--gold); }
.text-emerald { color: var(--emerald-bright); }
.text-ruby { color: var(--ruby-bright); }
.text-amethyst { color: var(--amethyst-bright); }

/* Background utility classes */
.bg-felt { background-color: var(--felt); }
.bg-felt-light { background-color: var(--felt-light); }
.bg-felt-raised { background-color: var(--felt-raised); }

/* ═══════════════════════════════════════════════════════════════════════════
   GLASS SURFACES
   ═══════════════════════════════════════════════════════════════════════════ */

.glass {
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
}

.glass-raised {
  background: var(--surface-raised);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-medium);
}

/* ═══════════════════════════════════════════════════════════════════════════
   BUTTONS & INTERACTIVE ELEMENTS
   ═══════════════════════════════════════════════════════════════════════════ */

button, [role="button"], a {
  transition: all 0.15s ease-out;
}

/* Primary button - gold accent */
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  color: var(--felt);
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-bright) 0%, var(--gold) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 168, 83, 0.35);
}

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

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Secondary button */
.btn-secondary {
  background: var(--felt-raised);
  color: var(--ivory);
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-medium);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8125rem;
}

.btn-secondary:hover {
  background: var(--felt-light);
  border-color: var(--border-strong);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Emerald action button */
.btn-action {
  background: linear-gradient(135deg, var(--emerald-bright) 0%, var(--emerald) 100%);
  color: white;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
  box-shadow: 0 4px 20px rgba(45, 138, 94, 0.3);
}

.btn-action:hover {
  background: linear-gradient(135deg, var(--emerald-bright) 20%, var(--emerald-bright) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(45, 138, 94, 0.4);
}

.btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BADGES
   ═══════════════════════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-gold {
  background: rgba(212, 168, 83, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

.badge-emerald {
  background: rgba(45, 138, 94, 0.15);
  color: var(--emerald-bright);
  border: 1px solid rgba(45, 138, 94, 0.3);
}

.badge-amethyst, .badge-purple {
  background: rgba(139, 95, 191, 0.15);
  color: var(--amethyst-bright);
  border: 1px solid rgba(139, 95, 191, 0.3);
}

.badge-ruby, .badge-red {
  background: rgba(194, 59, 59, 0.15);
  color: var(--ruby-bright);
  border: 1px solid rgba(194, 59, 59, 0.3);
}

.badge-yellow {
  background: rgba(212, 168, 83, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PLAYING CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: var(--card-radius);
  background: white;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 4px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
  flex-shrink: 0;
  overflow: hidden;
}

.card.card-lg {
  width: var(--card-width-lg);
  height: var(--card-height-lg);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.4),
    0 8px 16px rgba(0, 0, 0, 0.2);
}

.card.selected {
  transform: translateY(-6px) scale(1.05);
  box-shadow:
    0 0 0 3px var(--gold),
    0 8px 20px rgba(212, 168, 83, 0.4);
}

.card.pending {
  opacity: 0.85;
  box-shadow:
    0 0 0 2px var(--emerald-bright),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Card in hand - interactive */
.card-in-hand {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.card-in-hand:active {
  transform: scale(0.95);
}

/* Card marked for discard */
.card.will-discard {
  opacity: 0.7;
  position: relative;
  box-shadow:
    0 0 0 2px var(--ruby),
    0 2px 4px rgba(0, 0, 0, 0.3);
}

.discard-label {
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ruby);
  color: white;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GAME BOARD ROWS
   ═══════════════════════════════════════════════════════════════════════════ */

.board-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.board-row-label {
  width: 3.5rem;
  flex-shrink: 0;
}

.board-row-label .row-name {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ivory-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.board-row-label .row-count {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--ivory-muted);
  opacity: 0.6;
}

.board-row-cards {
  display: flex;
  gap: 0.25rem;
  flex: 1;
  justify-content: center;
  min-height: calc(var(--card-height) + 0.5rem);
  align-items: center;
}

.board-row-info {
  width: 6.5rem;
  flex-shrink: 0;
  text-align: right;
}

.board-row-info .hand-name {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--ivory-dim);
  line-height: 1.3;
}

.board-row-info .royalty-value {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--gold);
}

/* Clickable placement rows */
.board-row-clickable {
  background: rgba(255, 255, 255, 0.02);
  border: 2px dashed var(--border-subtle);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  user-select: none;
}

.board-row-clickable:hover {
  background: rgba(45, 138, 94, 0.08);
  border-color: var(--emerald);
}

/* Mobile active state for placement rows */
@media (max-width: 767px) {
  .board-row-clickable:active {
    background: rgba(45, 138, 94, 0.15);
    border-color: var(--emerald-bright);
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TIMER
   ═══════════════════════════════════════════════════════════════════════════ */

.timer-display {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ivory);
  letter-spacing: 0.05em;
}

.timer-bar {
  height: 4px;
  background: var(--emerald);
  border-radius: 2px;
  transition: width 0.1s linear, background-color 0.3s ease;
}

.timer-warning .timer-display,
.timer-warning .timer-text {
  color: var(--gold);
}

.timer-warning .timer-bar {
  background: var(--gold);
}

.timer-critical .timer-display,
.timer-critical .timer-text {
  color: var(--ruby-bright);
  animation: pulse 0.5s infinite;
}

.timer-critical .timer-bar {
  background: var(--ruby);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMOTES
   ═══════════════════════════════════════════════════════════════════════════ */

.emote-btn {
  background: var(--felt-raised);
  color: var(--ivory-dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.375rem 0.625rem;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.emote-btn:hover {
  background: var(--felt-light);
  color: var(--ivory);
  border-color: var(--border-medium);
}

.emote-btn:active {
  transform: scale(0.95);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(-8px); }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-fade-in {
  animation: fadeIn 0.2s ease-out forwards;
}

.animate-fade-out {
  animation: fadeOut 0.3s ease-in forwards;
}

.animate-slide-in-down {
  animation: slideInDown 0.3s ease-out forwards;
}

.animate-shimmer {
  background: linear-gradient(90deg, transparent 25%, rgba(255, 255, 255, 0.05) 50%, transparent 75%);
  background-size: 200% 100%;
  animation: shimmer 2s infinite;
}

.animate-pulse-fast {
  animation: pulse 0.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GLOW EFFECTS
   ═══════════════════════════════════════════════════════════════════════════ */

.glow-gold {
  box-shadow: 0 0 24px rgba(212, 168, 83, 0.2);
}

.glow-emerald {
  box-shadow: 0 0 24px rgba(45, 138, 94, 0.2);
}

.glow-purple, .glow-amethyst {
  box-shadow: 0 0 24px rgba(139, 95, 191, 0.2);
}

.glow-ruby {
  box-shadow: 0 0 24px rgba(194, 59, 59, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════════════ */

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  background: var(--felt-light);
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--ivory);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 168, 83, 0.15);
}

input::placeholder {
  color: var(--ivory-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--felt);
}

::-webkit-scrollbar-thumb {
  background: var(--felt-raised);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--ivory-muted);
}

@media (max-width: 640px) {
  ::-webkit-scrollbar {
    display: none;
  }
  * {
    scrollbar-width: none;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.stat-card {
  background: var(--felt-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--ivory-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.375rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEADERBOARD
   ═══════════════════════════════════════════════════════════════════════════ */

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--felt-light);
  border: 1px solid var(--border-subtle);
}

.leaderboard-entry-current {
  background: linear-gradient(90deg, rgba(212, 168, 83, 0.1) 0%, transparent 100%);
  border-left: 3px solid var(--gold);
}

.leaderboard-rank {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  width: 2rem;
  text-align: center;
}

.rank-1 { color: #ffd700; }
.rank-2 { color: #c0c0c0; }
.rank-3 { color: #cd7f32; }

/* ═══════════════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════════════ */

.border-subtle { border-color: var(--border-subtle); }
.border-medium { border-color: var(--border-medium); }
.border-strong { border-color: var(--border-strong); }

/* Responsive text sizing */
@media (min-width: 640px) {
  body {
    font-size: 15px;
  }
}

@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
}
