/* ============================================================
   Scrum Poker — Hand-drawn aesthetic
   ============================================================ */

:root {
  --ink:       #1a1a1a;
  --paper:     #fef9f0;
  --card-bg:   #fffdf7;
  --teal:      #2a9d8f;
  --coral:     #e63946;
  --amber:     #f4a261;
  --shadow:    3px 3px 0 var(--ink);
  --shadow-lg: 6px 6px 0 var(--ink);
  --r-sketch:  12px 4px 14px 3px / 3px 14px 4px 12px;
}

/* ── Base ── */
body {
  background-color: var(--paper);
  /* Graph-paper grid + subtle noise */
  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 type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E"),
    linear-gradient(rgba(26,26,26,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26,26,26,.035) 1px, transparent 1px);
  background-size: 300px 300px, 28px 28px, 28px 28px;
}

/* ── Header ── */
.sketch-header {
  background: var(--card-bg);
  border-bottom: 2px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
}

/* ── Core sketch box ── */
.sketch {
  border: 2px solid var(--ink);
  border-radius: var(--r-sketch);
  box-shadow: var(--shadow);
}

/* ── Buttons ── */
.sketch-btn {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  font-weight: 600;
  padding: 9px 22px;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px 3px 12px 2px / 2px 12px 3px 10px;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
  transition: transform .12s, box-shadow .12s, background .15s;
  line-height: 1.2;
}
.sketch-btn:hover        { transform: translate(-1px,-2px); box-shadow: 4px 5px 0 var(--ink); }
.sketch-btn:active       { transform: translate(2px,2px);  box-shadow: 1px 1px 0 var(--ink); }
.sketch-btn:disabled     { opacity:.5; cursor:not-allowed; }
.sketch-btn:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ── Text inputs / textarea ── */
.sketch-input {
  font-family: 'Caveat', cursive;
  font-size: 1.2rem;
  padding: 10px 14px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px 3px 10px 2px / 2px 10px 3px 8px;
  box-shadow: 2px 2px 0 var(--ink);
  outline: 2px solid transparent;
  width: 100%;
  transition: box-shadow .15s, border-color .15s;
  color: var(--ink);
  display: block;
}
.sketch-input:focus {
  outline: none;
  box-shadow: 3px 3px 0 var(--teal);
  border-color: var(--teal);
}
.sketch-input::placeholder { color: rgba(26,26,26,.35); }

/* ── Radio buttons ── */
.sketch-radio {
  appearance: none;
  width: 20px; height: 20px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color .15s;
}
.sketch-radio:checked { border-color: var(--teal); }
.sketch-radio:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }
.sketch-radio:checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: var(--teal);
  border-radius: 50%;
}

/* ── Range slider ── */
.sketch-range {
  appearance: none;
  height: 5px;
  background: repeating-linear-gradient(
    90deg, var(--ink) 0, var(--ink) 4px, transparent 4px, transparent 9px);
  border-radius: 3px;
  cursor: pointer;
  width: 100%;
}
.sketch-range::-webkit-slider-thumb {
  appearance: none;
  width: 22px; height: 22px;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 2px 2px 0 var(--ink);
  cursor: grab;
}
.sketch-range::-webkit-slider-thumb:active { cursor: grabbing; }
.sketch-range:focus-visible { outline: 3px solid var(--teal); outline-offset: 4px; }

/* ── Invite code ── */
.invite-code {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .18em;
  background: var(--paper);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px 2px 10px 3px / 3px 10px 2px 8px;
  padding: 2px 14px;
  box-shadow: var(--shadow);
  display: inline-block;
  cursor: pointer;
  transition: background .2s, transform .1s;
  user-select: all;
  /* button reset */
  appearance: none;
  -webkit-appearance: none;
  line-height: inherit;
}
.invite-code:hover        { background: #e7f5f4; transform: translateY(-1px); }
.invite-code:active       { transform: translateY(1px); }
.invite-code:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }

/* ── Voting cards ── */
.vote-card {
  width: 78px;
  height: 118px;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: 10px 3px 12px 4px / 4px 12px 3px 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .15s;
  animation: card-deal .35s cubic-bezier(.34,1.56,.64,1) both;
}
/* Subtle per-card rotations */
.vote-card:nth-child(4n+1) { transform: rotate(-1.8deg); }
.vote-card:nth-child(4n+2) { transform: rotate(1.3deg);  }
.vote-card:nth-child(4n+3) { transform: rotate(-0.7deg); }
.vote-card:nth-child(4n)   { transform: rotate(1.8deg);  }

.vote-card:hover {
  transform: translateY(-14px) rotate(0deg) !important;
  box-shadow: var(--shadow-lg);
  z-index: 10;
}
.vote-card:focus-visible {
  transform: translateY(-14px) rotate(0deg) !important;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  outline: 3px solid var(--teal);
  outline-offset: 2px;
}
.vote-card.selected {
  background: var(--teal);
  color: #fff;
  transform: translateY(-16px) rotate(0deg) !important;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}
.vote-card.token-card { border-style: dashed; }
.vote-card.token-card.selected { background: var(--amber); color: var(--ink); }
.vote-card.abstain-card { border-style: dotted; font-style: italic; opacity: 0.75; }
.vote-card.abstain-card.selected { opacity: 1; }

/* Revealed cards (retrospective + result view) */
.revealed-card {
  width: 78px;
  height: 118px;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: 10px 3px 12px 4px / 4px 12px 3px 10px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55rem;
  font-family: 'Caveat', cursive;
  font-weight: 700;
}

/* Retrospective mini-cards */
.retro-card {
  width: 58px;
  height: 86px;
  background: var(--card-bg);
  border: 2px solid var(--ink);
  border-radius: 8px 2px 10px 3px / 3px 10px 2px 8px;
  box-shadow: 2px 2px 0 var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-family: 'Caveat', cursive;
  font-weight: 700;
}

/* ── Player list reset ── */
#player-list { list-style: none; padding: 0; margin: 0; }

/* ── Player sidebar ── */
.player-avatar {
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  text-transform: uppercase;
  color: var(--ink);
}
.player-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(26,26,26,.12);
}
.voted-indicator {
  font-size: 1.1rem;
  opacity: .3;
  transition: opacity .3s, color .3s;
  flex-shrink: 0;
}
.voted-indicator.voted {
  opacity: 1;
  color: var(--teal);
}

/* ── Timer ── */
.timer-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.15rem;
  font-weight: 700;
  font-family: 'Caveat', cursive;
  line-height: 1;
}

/* ── Doodle divider ── */
.doodle-divider {
  border: none;
  height: 2px;
  background: repeating-linear-gradient(
    90deg, var(--ink) 0, var(--ink) 6px, transparent 6px, transparent 12px);
  opacity: .15;
  margin: 20px 0;
}

/* ── Notifications ── */
.poker-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 12px 4px 14px 3px / 3px 14px 4px 12px;
  box-shadow: var(--shadow);
  padding: 10px 18px;
  font-family: 'Caveat', cursive;
  font-size: 1.1rem;
  z-index: 9999;
  max-width: 280px;
  border-left-width: 4px;
  animation: slide-in .3s ease both;
  transition: opacity .3s;
}

/* ── Animations ── */
@keyframes card-deal {
  from { transform: translateY(-28px) rotate(12deg); opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slide-in {
  from { transform: translateY(-14px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}
@keyframes pop-in {
  from { transform: scale(.7) rotate(-5deg); opacity: 0; }
  to   { transform: scale(1)  rotate(0deg);  opacity: 1; }
}
@keyframes wobble {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-4deg); }
  40% { transform: rotate(4deg); }
  60% { transform: rotate(-2deg); }
  80% { transform: rotate(2deg); }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

.animate-slide-in { animation: slide-in  .35s ease both; }
.animate-pop      { animation: pop-in    .4s  cubic-bezier(.34,1.56,.64,1) both; }
.animate-wobble   { animation: wobble    .55s ease; }
.animate-float    { animation: float     3s  ease-in-out infinite; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .vote-card { width: 60px; height: 90px; font-size: 1.2rem; }
  .revealed-card { width: 58px; height: 86px; font-size: 1.2rem; }
}
