/* The Parlor — shared game styles */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,900;1,700&family=Lora:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  --wood-dark: #2d1b0e;
  --wood-mid: #4a2c1a;
  --wood-light: #6b3e23;
  --felt: #1e5b3f;
  --felt-dark: #143d29;
  --felt-light: #2a7a55;
  --gold: #d4a574;
  --gold-bright: #f4c896;
  --cream: #d4a574;
  --ink: #1a1410;
  --red: #c0392b;
  --shadow: rgba(0,0,0,0.4);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  min-height: 100vh;
  font-family: 'Lora', Georgia, serif;
  color: var(--cream);
  background-color: #2d1b0e;
  background-image:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(140, 80, 40, 0.5) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='400' viewBox='0 0 200 400'%3E%3Crect width='200' height='400' fill='%232d1b0e'/%3E%3Cg fill='none' stroke-linecap='round'%3E%3Cpath d='M0,20 Q50,15 100,22 T200,18' stroke='%23472815' stroke-width='1.5' opacity='0.7'/%3E%3Cpath d='M0,45 Q60,42 120,48 T200,44' stroke='%23553119' stroke-width='1' opacity='0.6'/%3E%3Cpath d='M0,70 Q40,68 90,73 T200,69' stroke='%231a0e07' stroke-width='2' opacity='0.8'/%3E%3Cpath d='M0,95 Q55,92 110,97 T200,93' stroke='%23472815' stroke-width='1' opacity='0.6'/%3E%3Cpath d='M0,118 Q70,115 140,121 T200,117' stroke='%235a3520' stroke-width='1.2' opacity='0.5'/%3E%3Cpath d='M0,145 Q45,141 95,148 T200,144' stroke='%231a0e07' stroke-width='1.8' opacity='0.7'/%3E%3Cpath d='M0,170 Q65,168 130,172 T200,169' stroke='%23472815' stroke-width='1' opacity='0.6'/%3E%3Cpath d='M0,195 Q50,192 100,198 T200,194' stroke='%23553119' stroke-width='1.5' opacity='0.7'/%3E%3Cpath d='M0,220 Q60,218 120,223 T200,219' stroke='%231a0e07' stroke-width='1.2' opacity='0.6'/%3E%3Cpath d='M0,245 Q40,242 90,248 T200,244' stroke='%23472815' stroke-width='1' opacity='0.5'/%3E%3Cpath d='M0,272 Q70,268 140,275 T200,270' stroke='%235a3520' stroke-width='1.8' opacity='0.7'/%3E%3Cpath d='M0,297 Q55,294 110,300 T200,296' stroke='%231a0e07' stroke-width='1.2' opacity='0.6'/%3E%3Cpath d='M0,322 Q45,319 95,325 T200,321' stroke='%23472815' stroke-width='1.5' opacity='0.7'/%3E%3Cpath d='M0,347 Q65,344 130,349 T200,346' stroke='%23553119' stroke-width='1' opacity='0.6'/%3E%3Cpath d='M0,372 Q50,370 100,375 T200,371' stroke='%231a0e07' stroke-width='1.8' opacity='0.7'/%3E%3C/g%3E%3Cellipse cx='40' cy='130' rx='8' ry='3' fill='none' stroke='%231a0e07' stroke-width='1.2' opacity='0.6'/%3E%3Cellipse cx='40' cy='130' rx='4' ry='1.5' fill='%23472815' opacity='0.5'/%3E%3Cellipse cx='160' cy='280' rx='10' ry='3.5' fill='none' stroke='%231a0e07' stroke-width='1.2' opacity='0.6'/%3E%3Cellipse cx='160' cy='280' rx='5' ry='1.5' fill='%23472815' opacity='0.5'/%3E%3C/svg%3E");
  background-size: auto, 200px 400px;
  background-repeat: no-repeat, repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(20px + env(safe-area-inset-top, 0px)) 16px 40px;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' seed='5'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.15 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
}

body::after { content: none; }

.topbar {
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
  min-height: 42px;
  z-index: 1;
}

.back-btn {
  color: var(--cream);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(212, 165, 116, 0.3);
  border-radius: 6px;
  padding: 8px 14px;
  font-family: 'Lora', serif;
  font-size: 14px;
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-btn:hover {
  background: rgba(212, 165, 116, 0.15);
  color: var(--cream);
  border-color: var(--gold);
}

.title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: clamp(15px, 4.4vw, 24px);
  color: var(--cream);
  letter-spacing: 0.5px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  max-width: 56vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn {
  background: linear-gradient(180deg, var(--felt-light), var(--felt));
  color: var(--cream);
  border: 1px solid rgba(212, 165, 116, 0.4);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Lora', serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn:hover {
  background: linear-gradient(180deg, #3a9268, var(--felt-light));
  border-color: var(--gold);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0); }

.btn.primary {
  background: linear-gradient(180deg, var(--felt-light), var(--felt));
  color: var(--cream);
  border-color: var(--gold);
}
.btn.primary:hover {
  background: linear-gradient(180deg, #3a9268, var(--felt-light));
}

.panel {
  background: linear-gradient(135deg, var(--wood-mid), var(--wood-dark));
  border: 1px solid rgba(212, 165, 116, 0.25);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,200,140,0.1);
  position: relative;
  z-index: 1;
}

.felt {
  background:
    radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt) 50%, var(--felt-dark) 100%);
  border: 8px solid var(--wood-dark);
  border-radius: 8px;
  box-shadow:
    0 0 0 2px var(--gold) inset,
    0 8px 32px rgba(0,0,0,0.5),
    inset 0 0 60px rgba(0,0,0,0.3);
  position: relative;
  z-index: 1;
}

.status {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: var(--cream);
  letter-spacing: 0.5px;
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.3s;
}
.overlay.active { display: flex; }

.modal {
  background: linear-gradient(135deg, var(--wood-mid), var(--wood-dark));
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 32px 40px;
  text-align: center;
  max-width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  animation: pop 0.4s cubic-bezier(0.2, 1.4, 0.3, 1);
}
.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 36px;
  color: var(--cream);
  margin-bottom: 12px;
}
.modal p { color: var(--cream); margin-bottom: 20px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- Playing-card styles (used by card games) ---- */
.pc-card {
  background: var(--cream);
  border: 1px solid #888;
  border-radius: 5px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
  color: var(--ink);
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  user-select: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 56px;
  height: 80px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pc-card.red { color: var(--red); }
.pc-card.black { color: var(--ink); }
.pc-card.selected { box-shadow: 0 0 0 3px var(--gold-bright), 0 4px 12px rgba(0,0,0,0.6); transform: translateY(-6px); }
.pc-card.dim { opacity: 0.5; cursor: not-allowed; }
.pc-card.back {
  background:
    repeating-linear-gradient(45deg, #2c5e8c 0, #2c5e8c 4px, #1a4570 4px, #1a4570 8px),
    var(--gold);
  border-color: var(--gold);
  cursor: default;
}
.pc-card.back::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(212,165,116,0.6);
  border-radius: 3px;
}
.pc-corner { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; line-height: 1; }
.pc-corner.bot { transform: rotate(180deg); margin-top: auto; align-self: flex-end; }
.pc-rank { font-size: 13px; font-weight: 900; }
.pc-suit { font-size: 11px; }
.pc-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
}

.pc-card.lg { width: 72px; height: 104px; padding: 6px; }
.pc-card.lg .pc-rank { font-size: 16px; }
.pc-card.lg .pc-suit { font-size: 13px; }
.pc-card.lg .pc-center { font-size: 30px; }

.pc-card.sm { width: 40px; height: 58px; padding: 3px; }
.pc-card.sm .pc-rank { font-size: 10px; }
.pc-card.sm .pc-suit { font-size: 8px; }
.pc-card.sm .pc-center { font-size: 16px; }

.hand {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 8px;
  min-height: 100px;
}
