/* Real or Imagined? (Describe the Picture) player. Same table look as What Happens Next? and Story Cards. */

/* 1. Tokens */

.lh-player {
  --table: #e9e3d8;
  --ink: #2b2a28;
  --title: #4d473d;
  --muted: #8a7f6c;
  --counter: #9a917f;
  --icon: #7d7466;
  --icon-hover: #4d473d;
  --navy: #26436e;
  --blue: #1875d0;
  --blue-edge: #125ca6;
  --paper: #fbf7ef;
  --real: #2e8b57;
  --imagined: #c4572d;
  --white: #fff;
  --focus: rgba(24, 117, 208, 0.35);
  --edge: #d6cebf;
  --shadow-card: 0 16px 34px rgba(60, 45, 20, 0.20);
  --radius: 18px;
  --radius-inner: 10px;
  --radius-pill: 999px;
  --font: "Nunito", sans-serif;
  --stage-w: min(100%, 720px, calc((100vh - 380px) * 1.6));
}

body.page-dsc {
  overflow-x: hidden;
  background: var(--table, #e9e3d8);
}

body.page-dsc .mainCenter {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

/* 2. Layout and resets */

.lh-player {
  box-sizing: border-box;
  width: 100%;
  min-height: calc(100vh - 60px);
  margin: 0;
  padding: 28px 16px 36px;
  overflow-x: hidden;
  background: var(--table);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.lh-player *,
.lh-player *::before,
.lh-player *::after {
  box-sizing: border-box;
}

.lh-player p {
  margin: 0;
  max-width: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}

.lh-player button {
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  box-shadow: none;
  cursor: pointer;
}

.lh-player button:hover,
.lh-player button:disabled {
  background: transparent;
  color: inherit;
  box-shadow: none;
}

.lh-player button:focus {
  outline: none;
}

.lh-player [hidden] {
  display: none !important;
}

.lh-player h1 {
  margin: 0;
  padding: 0;
  color: var(--title);
  font-family: var(--font);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
}

.lh-player .player-description {
  width: min(100%, 560px);
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}

/* 3. Stage */

.dsc-stage {
  width: var(--stage-w);
  margin: 22px auto 0;
}

.dsc-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  margin: 0 6px 10px;
}

.dsc-phase {
  color: var(--title);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lh-player[data-state="reveal"][data-kind="real"] .dsc-phase { color: var(--real); }
.lh-player[data-state="reveal"][data-kind="imagined"] .dsc-phase { color: var(--imagined); }

.dsc-time {
  color: var(--navy);
  font-size: 26px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transition: color 200ms ease;
}

.lh-player[data-state="think"] .dsc-time {
  color: var(--muted);
}

.lh-player.is-last-seconds .dsc-time {
  color: var(--imagined);
}

.dsc-frame {
  padding: 10px;
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow-card);
}

.dsc-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-inner);
  background: #1d1c1a;
}

.dsc-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: dsc-in 260ms ease;
}

/* The imaginary picture: a sentence on paper, in a dashed "photo" frame */
.dsc-imagine {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 7% 9%;
  background: var(--paper);
  text-align: center;
  animation: dsc-in 260ms ease;
}

.dsc-imagine::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 3px dashed var(--edge);
  border-radius: 8px;
  pointer-events: none;
}

.dsc-imagine-label {
  color: var(--imagined);
  font-size: clamp(13px, 1.9vw, 16px);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.dsc-imagine-text {
  color: var(--ink);
  font-size: clamp(24px, 4.6vw, 42px);
  font-weight: 900;
  line-height: 1.15;
}

.lh-player[data-state="reveal"] .dsc-imagine-hint {
  visibility: hidden;
}

.dsc-imagine-hint {
  color: var(--muted);
  font-size: clamp(13px, 1.9vw, 16px);
}

/* Cover: before a round and while the class guesses */
.dsc-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8%;
  background: var(--navy);
  color: var(--white);
  text-align: center;
  animation: dsc-in 220ms ease;
}

.dsc-cover-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(64px, 11vw, 96px);
  height: clamp(64px, 11vw, 96px);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: clamp(38px, 6.5vw, 58px);
  font-weight: 900;
  line-height: 1;
}

.dsc-cover-text {
  max-width: 460px;
  font-size: clamp(18px, 3vw, 26px);
  font-weight: 800;
  line-height: 1.25;
}

.lh-player[data-state="guess"] .dsc-cover-mark {
  animation: dsc-pulse 1.8s ease-in-out infinite;
}

/* Real / Imagined stamp on the answer */
.dsc-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  color: var(--white);
  font-size: clamp(16px, 2.6vw, 22px);
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.35), 0 8px 18px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: scale(0.6) rotate(-6deg);
  pointer-events: none;
}

.lh-player[data-state="reveal"] .dsc-badge {
  opacity: 1;
  transform: rotate(-4deg);
  transition: opacity 180ms ease, transform 320ms cubic-bezier(.3, 1.6, .5, 1);
}

.lh-player[data-kind="real"] .dsc-badge { background: var(--real); }
.lh-player[data-kind="imagined"] .dsc-badge { background: var(--imagined); }

/* Time bar under the picture */
.dsc-bar {
  height: 6px;
  margin: 10px 2px 0;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: #efe9de;
}

.dsc-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 200ms linear;
}

.lh-player[data-state="think"] .dsc-bar span { background: var(--counter); }
.lh-player.is-last-seconds .dsc-bar span { background: var(--imagined); }
.lh-player[data-state="ready"] .dsc-bar span,
.lh-player[data-state="reveal"] .dsc-bar span { width: 0 !important; transition: none; }

.lh-player .dsc-count {
  margin: 14px 0 0;
  min-height: 17px;
  color: var(--counter);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}

@keyframes dsc-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dsc-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* 4. Buttons */

.lh-player .player-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 14px;
  width: var(--stage-w);
  margin: 20px auto 0;
}

.lh-player .player-tools {
  display: flex;
  justify-self: start;
  align-items: center;
  gap: 8px;
}

.lh-player .pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  height: 54px;
  padding: 0 40px;
  border-radius: var(--radius-pill);
  background: var(--blue);
  color: var(--white);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--blue-edge);
}

.lh-player .pill-btn:hover {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 4px 0 var(--blue-edge);
}

.lh-player .pill-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--blue-edge);
}

.lh-player .pill-btn:focus-visible {
  box-shadow: 0 4px 0 var(--blue-edge), 0 0 0 3px var(--focus);
}

.lh-player .round-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--white);
  color: var(--title);
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  padding-bottom: 4px;
  box-shadow: 0 2px 0 var(--edge);
}

.lh-player .round-btn:hover {
  background: var(--white);
  color: var(--title);
  box-shadow: 0 2px 0 var(--edge);
}

.lh-player .round-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--edge);
}

.lh-player .round-btn:focus-visible {
  box-shadow: 0 2px 0 var(--edge), 0 0 0 3px var(--focus);
}

.lh-player .round-btn:disabled,
.lh-player .round-btn:disabled:hover {
  background: var(--white);
  color: var(--title);
  opacity: 0.35;
  cursor: default;
  transform: none;
}

.lh-player .icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--icon);
}

.lh-player .icon-btn svg {
  display: block;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lh-player .icon-btn:hover {
  background: transparent;
  color: var(--icon-hover);
}

.lh-player .icon-btn:focus-visible {
  border-radius: 8px;
  box-shadow: 0 0 0 3px var(--focus);
}

.lh-player .dsc-sub {
  min-height: 40px;
  margin: 12px 0 0;
  text-align: center;
}

.lh-player .text-btn {
  padding: 10px 4px;
  color: var(--title);
  font-size: 16px;
  font-weight: 800;
}

.lh-player .text-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

.lh-player .text-btn:focus-visible {
  border-radius: 6px;
  box-shadow: 0 0 0 3px var(--focus);
}

/* 5. Full screen */

.lh-player:fullscreen,
.lh-player:-webkit-full-screen {
  --stage-w: min(100%, calc((100vh - 240px) * 1.6));
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  height: 100%;
  padding: 16px 24px 20px;
  overflow: auto;
}

.lh-player:fullscreen h1,
.lh-player:-webkit-full-screen h1 {
  color: var(--muted);
  font-size: 16px;
}

.lh-player:fullscreen .player-description,
.lh-player:-webkit-full-screen .player-description {
  display: none;
}

.lh-player:fullscreen .dsc-stage,
.lh-player:-webkit-full-screen .dsc-stage {
  margin-top: 12px;
}

.lh-player:fullscreen .player-actions,
.lh-player:fullscreen .dsc-sub,
.lh-player:fullscreen .player-heading,
.lh-player:-webkit-full-screen .player-actions,
.lh-player:-webkit-full-screen .dsc-sub,
.lh-player:-webkit-full-screen .player-heading {
  transition: opacity 200ms ease;
}

.lh-player:fullscreen.is-idle,
.lh-player:fullscreen.is-idle *,
.lh-player:-webkit-full-screen.is-idle,
.lh-player:-webkit-full-screen.is-idle * {
  cursor: none;
}

.lh-player:fullscreen.is-idle .player-actions,
.lh-player:fullscreen.is-idle .dsc-sub,
.lh-player:fullscreen.is-idle .player-heading,
.lh-player:-webkit-full-screen.is-idle .player-actions,
.lh-player:-webkit-full-screen.is-idle .dsc-sub,
.lh-player:-webkit-full-screen.is-idle .player-heading {
  opacity: 0;
  pointer-events: none;
}

/* 6. Phones */

@media (max-width: 560px) {
  .lh-player {
    padding: 24px 12px 28px;
  }

  .dsc-stage,
  .lh-player .player-actions {
    width: 100%;
  }

  .dsc-frame {
    padding: 6px;
    border-radius: 14px;
  }

  .dsc-imagine::before {
    inset: 10px;
  }

  .lh-player .player-actions {
    grid-template-columns: 52px minmax(0, 1fr) 52px;
    column-gap: 8px;
  }

  .lh-player .pill-btn {
    min-width: 0;
    width: 100%;
    height: 52px;
    padding: 0 16px;
  }

  .lh-player .round-btn {
    width: 52px;
    height: 52px;
  }

  .lh-player .full-btn {
    display: none;
  }
}

/* 7. Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .dsc-photo,
  .dsc-imagine,
  .dsc-cover,
  .lh-player[data-state="guess"] .dsc-cover-mark {
    animation: none;
  }

  .lh-player[data-state="reveal"] .dsc-badge {
    transition: none;
  }
}
