/* PictionarAI stylesheet.
 * Original cascade order is preserved, including responsive overrides.
 */

/* Theme and defaults */

:root {
  font-family: Arial, Helvetica, sans-serif;
  color: #19261f;
  background: #f5f5ec;
  font-synthesis: none;
  --green: #c5f36b;
  --ink: #19261f;
  --muted: #6d7469;
}

/* Reset and accessibility */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button, input {
  font: inherit;
}

button {
  cursor: pointer;
  /* Removes the 300ms tap delay and stops the browser from hijacking the
     press gesture, which otherwise cancels :active on touch devices. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

button:focus-visible, a:focus-visible, .upload:focus-within {
  outline: 3px solid #517b1b;
  outline-offset: 5px;
}

[hidden] {
  display: none !important;
}

/* Header and navigation */

header {
  max-width: 1440px;
  margin: auto;
  padding: 28px 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #dce0d2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: -.6px;
}

.brand-icon {
  font-size: 36px;
}

.tag {
  font-size: 9px;
  letter-spacing: 1.3px;
  margin-left: 12px;
  border-left: 1px solid #bac2b2;
  padding-left: 18px;
}

.quiet {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 12px;
  font-size: 13px;
  font-weight: 600;
}

.quiet span {
  margin-left: 12px;
}

/* Abort sits in the quiz header and must stay noticeable without
   competing with the answer buttons: outlined, flat and green-toned. */
.quiet#abort {
  border: 1px solid #cdd5c1;
  border-radius: 7px;
  background: #eeefdf;
  padding: 10px 18px;
  color: #4c5b34;
}

.quiet#abort:hover {
  background: #e2e4d1;
  color: var(--ink);
}

/* Page layout and typography */

main {
  max-width: 1180px;
  margin: auto;
  padding: 48px 32px 65px;
  min-height: calc(100vh - 166px);
}

.hero {
  text-align: center;
  padding: 22px 0 0;
}

.eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #69a637;
  border-radius: 50%;
  margin-right: 9px;
}

h1 {
  font-size: clamp(56px, 7.4vw, 98px);
  letter-spacing: -6px;
  line-height: 1.02;
  font-weight: 800;
  margin: 28px 0 22px;
}

h1 em {
  font-family: Georgia, serif;
  font-weight: 400;
}

h2 {
  font-size: 38px;
  letter-spacing: -1.7px;
  margin: 15px 0;
}

h3 {
  font-size: 19px;
}

.intro {
  font-size: 19px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
}

.intro.small {
  font-size: 16px;
  max-width: 680px;
}

/* Legacy three-column rules layout */

.rules {
  display: flex;
  justify-content: center;
  margin: 34px auto;
  gap: 0;
}

.rules>div {
  min-width: 170px;
  padding: 0 26px;
  border-right: 1px solid #d5dacb;
}

.rules>div:last-child {
  border: 0;
}

.rules strong {
  display: block;
  font-size: 23px;
  letter-spacing: -.7px;
}

.rules span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 9px;
}

/* Buttons and supporting text */

.primary {
  background: var(--green);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 9px;
  padding: 20px 28px;
  min-width: 255px;
  font-weight: 700;
  font-size: 16px;
  box-shadow: 0 3px 0 var(--ink);
  /* Same press feedback as the answer buttons. The margin compensates
     for the shadow so the button keeps its original footprint. */
  margin-bottom: 3px;
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}

.primary:hover:not(:disabled) {
  background: #b5e659;
}

/* The .pressing class mirrors :active because touch browsers can cancel the
   :active state mid-gesture, which made the button only react on release. */
.primary:active:not(:disabled),
.primary.pressing:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--ink);
}

.primary span {
  margin-left: 35px;
}

.primary.compact {
  min-width: 0;
  padding: 13px 23px;
  font-size: 14px;
}

.muted {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

#ready {
  margin-top: 21px;
}

.hero-note {
  font-size: 9px;
  letter-spacing: 2px;
  color: #88917d;
  margin-top: 44px;
}

/* Footer */

footer {
  border-top: 1px solid #dce0d2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 5%;
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
}

/* Admin: uploads and picture gallery */

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 30px 0 18px;
}

.upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  border: 1px dashed #9ba88f;
  border-radius: 16px;
  padding: 28px;
  background: #eeefdf;
  overflow: hidden;
  cursor: pointer;
}

.upload-icon {
  font-size: 32px;
}

.upload strong {
  font-size: 21px;
}

.upload>span:not(.upload-icon) {
  font-size: 13px;
  color: var(--muted);
}

.upload .file-button {
  background: white;
  border: 1px solid #c7cebd;
  padding: 10px 17px;
  border-radius: 7px;
  color: var(--ink) !important;
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.notice {
  font-size: 13px;
  color: #596348;
  line-height: 1.6;
}

.library-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 30px 0 20px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 15px;
}

.tile {
  border: 1px solid #d5dacb;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.tile img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.tile-bottom {
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: 12px;
}

.tile button {
  border: 0;
  background: #f1f2ea;
  border-radius: 5px;
  padding: 7px;
  color: #782f2f;
}

/* Quiz: progress, pictures, and answers */

.game {
  max-width: 960px;
  margin: auto;
}

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.score-pill {
  border: 1px solid #cdd5c1;
  border-radius: 30px;
  padding: 10px 18px;
  font-size: 11px;
  letter-spacing: 1px;
}

.score-pill strong {
  font-size: 17px;
  margin-left: 10px;
}

.progress {
  display: flex;
  gap: 7px;
  margin: 18px 0 25px;
}

.progress span {
  position: relative;
  height: 5px;
  flex: 1;
  background: #dfe3d6;
  border-radius: 5px;
}

/* The green fill is a scaled layer rather than a flat background colour,
   so each segment can slide in from the left and retract to the right. */
.progress span::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: #8ac440;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .35s ease, background-color .35s ease;
}

.progress span.correct::after {
  transform: scaleX(1);
}

.progress .active {
  background: #82956c;
}

.progress .wrong {
  background: #ca8872;
}

.picture-stage {
  background: #e8eadf;
  border: 1px solid #d9dece;
  border-radius: 15px;
  overflow: hidden;
  height: clamp(240px, 46vh, 560px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.picture-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  margin-top: 20px;
}

.question h2 {
  font-size: 28px;
  margin: 6px 0;
}

.question p {
  margin: 8px 0;
}

.answers {
  display: flex;
  gap: 12px;
}

.answer {
  border: 1px solid var(--ink);
  border-radius: 9px;
  padding: 16px 28px;
  min-width: 140px;
  font-weight: 800;
  font-size: 23px;
  /* Physical depth: a solid black edge under the button, matching the
     stacked look already used by .primary. The margin compensates for
     the shadow so the row height stays unchanged. */
  box-shadow: 0 4px 0 var(--ink);
  margin-bottom: 4px;
  transform: translateY(0);
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}

/* Pressing sinks the button into its own shadow, narrowing the visible
   edge and reading as a physical press. .pressing mirrors :active for
   touch devices where the pseudo-class is unreliable. */
.answer:active:not(:disabled),
.answer.pressing:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.answer span {
  display: block;
  font-size: 11px;
  font-weight: 400;
  margin-top: 5px;
}

/* AI (pale red) and Real (pale blue) are matched in lightness and
   saturation, so neither button may hint at the correct answer. */
.yes {
  background: #f6cfcf;
  color: #0a140d;
}

.yes:hover:not(:disabled) {
  background: #f0bdbd;
}

.no {
  background: #ccdcf2;
  color: #0a140d;
}

.no:hover:not(:disabled) {
  background: #b8cdec;
}

.feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 19px;
  padding: 15px 20px;
  border-radius: 10px;
  background: #e6edda;
}

.feedback p {
  margin: 0;
  line-height: 1.5;
}

.feedback.wrong {
  background: #f1e3d8;
}

/* Results screen */

.result-badge {
  display: inline-block;
  margin-top: 30px;
  padding: 9px 18px;
  border-radius: 30px;
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 2px;
}

.result-badge.fail {
  background: #ecd7c9;
}

/* Centre the result content vertically: masthead 166px is the shared
   header/footer allowance used by main, plus its 48px top and 65px
   bottom padding. The inherited .hero top padding is cancelled so the
   block sits optically centred. */
#result {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 166px - 113px);
  padding-top: 0;
}

#result h1 {
  font-size: 64px;
  letter-spacing: -3px;
  margin-top: 22px;
}

.final-score {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 25px 0;
}

.final-score strong {
  font-size: 86px;
  letter-spacing: -5px;
}

.final-score span {
  color: var(--muted);
  font-size: 20px;
}

.result-rounds {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 35px;
}

.round-result {
  border-radius: 8px;
  background: #dfebcd;
  padding: 12px;
  font-size: 12px;
}

.round-result.wrong {
  background: #ecdcd0;
}

.back-home {
  display: block;
  margin: 18px auto 0;
}

/* Small-screen layout */

@media (max-width: 650px) {
  header {
    padding: 18px 20px;
  }

  .tag {
    display: none;
  }

  .brand {
    font-size: 14px;
  }

  .brand-icon {
    font-size: 28px;
  }

  main {
    padding: 30px 20px 45px;
  }

  h1 {
    letter-spacing: -3px;
  }

  .rules>div {
    min-width: 0;
    padding: 0 16px;
  }

  .rules strong {
    font-size: 20px;
  }

  .rules span {
    font-size: 11px;
  }

  .upload-grid {
    grid-template-columns: 1fr;
  }

  .question {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .answers {
    width: 100%;
  }

  .answer {
    flex: 1;
    padding: 15px;
    min-width: 0;
  }

  .feedback {
    flex-direction: column;
    text-align: center;
  }

  .picture-stage {
    height: 39vh;
  }

  .result-rounds {
    gap: 5px;
  }

  .round-result {
    padding: 9px 6px;
    font-size: 11px;
  }

  footer {
    flex-direction: column;
    align-items: center;
    font-size: 8px;
  }

  #result h1 {
    font-size: 50px;
  }

}

/* Welcome: game instructions */

.game-rules {
  max-width: 620px;
  margin: 26px auto 34px;
  font-size: 16px;
  line-height: 1.8;
  color: var(--muted);
}

.game-rules strong {
  color: var(--ink);
  font-weight: 700;
}

.brand {
  gap: 20px;
  min-width: 0;
}

/* Logo and product branding */

.crossover-logo {
  display: block;
  width: 160px;
  height: auto;
  flex-shrink: 0;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.brand-name {
  font-size: 28px;
  letter-spacing: -1px;
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.5;
}

.quiet#manage {
  flex-shrink: 0;
}

#home h1 {
  white-space: nowrap;
  font-size: clamp(20px, 5.5vw, 72px);
  letter-spacing: -.045em;
  margin: 38px 0 26px;
}

/* Compact header */

@media (max-width: 800px) {
  header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .crossover-logo {
    width: 120px;
  }

  .brand-name {
    font-size: 24px;
  }

  .brand-subtitle {
    max-width: 340px;
  }

  .brand {
    gap: 12px;
  }

}

/* Phone header */

@media (max-width: 450px) {
  .crossover-logo {
    width: 90px;
  }

  .brand-name {
    font-size: 22px;
  }

  .brand-subtitle {
    font-size: 10px;
  }

  .brand {
    width: 100%;
  }

  #manage {
    margin-left: auto;
  }

  #home h1 {
    font-size: 5.5vw;
  }

}

/* Result screen: 3D ribbon celebration.
   The stage owns the perspective so each piece flips in real 3D space
   rather than rotating as a flat rectangle. */

.ribbon-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  perspective: 800px;
  z-index: 999;
}

.ribbon {
  position: absolute;
  top: -12vh;
  border-radius: 2px;
  opacity: .95;
  animation-name: ribbon-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes ribbon-fall {
  from {
    transform: translate3d(0, 0, 0) rotateX(0) rotateY(0) rotateZ(0);
  }

  to {
    transform: translate3d(var(--drift), 118vh, 0) rotateX(var(--tumble)) rotateY(var(--spin)) rotateZ(var(--spin));
  }
}
