/*
  DRAW RANDOM IMAGE — MAIN STYLES

  EASY CUSTOMIZATION:
  Change the colors and sizes in :root.
*/

:root {
  --page: #fffaf3;
  --paper: #ffffff;
  --text: #322544;
  --muted: #756b82;
  --line: #e7def0;
  --purple: #7957e8;
  --purple-dark: #5d3fc3;
  --purple-soft: #eee8ff;
  --orange: #ffb84d;
  --pink: #ff7fa5;
  --green: #48cfa0;
  --focus: #346fe0;
  --page-width: 1100px;
  --shadow: 0 20px 55px rgba(82, 57, 115, 0.13);
}

* { box-sizing: border-box; }
html { color-scheme: light; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 4% 20%, rgba(255, 184, 77, 0.23) 0 8rem, transparent 8.1rem),
    radial-gradient(circle at 96% 8%, rgba(121, 87, 232, 0.17) 0 11rem, transparent 11.1rem),
    radial-gradient(circle at 88% 92%, rgba(72, 207, 160, 0.16) 0 12rem, transparent 12.1rem),
    var(--page);
  font-family: "Trebuchet MS", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(121, 87, 232, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
  pointer-events: none;
}

button,
input,
select { font: inherit; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.site-header {
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
  padding: 1.35rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--text);
  font-weight: 900;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 2.65rem;
  height: 2.65rem;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--purple);
  border: 3px solid var(--text);
  border-radius: 44% 56% 52% 48% / 55% 42% 58% 45%;
  box-shadow: 4px 4px 0 var(--orange);
  font-size: 1.1rem;
  transform: rotate(-5deg);
}

.welcome {
  width: min(calc(100% - 2rem), var(--page-width));
  min-height: calc(100vh - 5.5rem);
  margin: 0 auto;
  padding: 1.5rem 0 5rem;
  display: grid;
  place-items: center;
}

.draw-card {
  position: relative;
  width: min(100%, 54rem);
  padding: clamp(2rem, 5vw, 4rem);
  text-align: center;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid var(--text);
  border-radius: 34px;
  box-shadow: 10px 12px 0 var(--purple-soft), var(--shadow);
}

.draw-card::after {
  content: "";
  position: absolute;
  top: -0.8rem;
  right: 2.5rem;
  width: 5rem;
  height: 1.4rem;
  background: rgba(255, 184, 77, 0.75);
  transform: rotate(4deg);
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 1rem;
  padding: 0.35rem 0.75rem;
  color: var(--purple-dark);
  background: var(--purple-soft);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.5rem, 8vw, 5.8rem);
  line-height: 0.88;
  letter-spacing: -0.07em;
}

.intro {
  max-width: 32rem;
  margin: 1.35rem auto 2rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.18rem);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  text-align: left;
}

.field {
  min-width: 0;
  padding: 1rem;
  display: grid;
  align-content: start;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.field-orange { background: #fff0cd; }
.field-green { background: #ddf8ee; }
.field-pink { background: #ffe8f0; }
.field-purple { background: var(--purple-soft); }

.field > span {
  font-size: 0.92rem;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid transparent;
  border-radius: 13px;
  box-shadow: 0 2px 0 rgba(50, 37, 68, 0.08);
}

input:hover,
select:hover { border-color: rgba(121, 87, 232, 0.28); }

.start-area {
  grid-column: 1 / -1;
  margin-top: 0.55rem;
  padding: 1.1rem 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: linear-gradient(110deg, var(--purple-soft), #ffe8f0 55%, #fff0cd);
  border-radius: 20px;
}

.draw-button {
  min-width: 9rem;
  min-height: 3.6rem;
  padding: 0.75rem 1.7rem;
  color: var(--text);
  background: var(--orange);
  border: 3px solid var(--text);
  border-radius: 999px;
  box-shadow: 5px 6px 0 var(--text);
  font-size: 1.25rem;
  font-weight: 1000;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.draw-button:hover {
  background: #ffc867;
  transform: translateY(-2px) rotate(-1deg);
  box-shadow: 6px 8px 0 var(--text);
}

.draw-button:active {
  transform: translateY(4px);
  box-shadow: 3px 3px 0 var(--text);
}

.draw-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.status {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.session {
  position: fixed;
  z-index: 50;
  inset: 0;
  color: var(--text);
  background: #f6f1ff;
}

.session[hidden] { display: none; }
.session-open { overflow: hidden; }

.session-header {
  height: 5rem;
  padding: 0 1.25rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.session-progress {
  display: grid;
}

.session-progress span {
  color: var(--muted);
  font-size: 0.8rem;
}

.session-timer {
  min-width: 6rem;
  padding: 0.45rem 0.8rem;
  color: var(--purple-dark);
  background: var(--purple-soft);
  border-radius: 999px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.session-header .button {
  justify-self: end;
}

.timer-track {
  height: 0.35rem;
  background: #e8def6;
}

.timer-track span {
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--purple), var(--pink), var(--orange));
  transition: width 0.2s linear;
}

.image-stage {
  height: calc(100vh - 10.85rem);
  padding: 1.25rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  background-image: radial-gradient(rgba(121, 87, 232, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
}

.image-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 16px 45px rgba(65, 43, 89, 0.18);
}

.session-controls {
  height: 5.5rem;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
}

.session-controls p {
  position: absolute;
  right: 1rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.button {
  min-height: 3rem;
  padding: 0.7rem 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  border-radius: 999px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button-primary {
  color: var(--text);
  background: var(--orange);
  border-color: var(--text);
  box-shadow: 4px 5px 0 var(--text);
}

.button-primary:hover {
  background: #ffc867;
  transform: translateY(-2px);
  box-shadow: 5px 7px 0 var(--text);
}

.button-secondary {
  color: var(--text);
  background: #fff;
  border-color: var(--line);
}

.button-secondary:hover {
  background: var(--purple-soft);
  border-color: var(--purple);
}

.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 1rem;
  padding: 0.75rem 1.05rem;
  color: #fff;
  background: var(--text);
  border-radius: 999px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 680px) {
  .welcome { align-items: start; }

  .draw-card {
    padding: 2.5rem 1.3rem 2.25rem;
    border-radius: 26px;
    box-shadow: 6px 7px 0 var(--purple-soft), var(--shadow);
  }

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

  .start-area { align-items: stretch; }
  .start-area .draw-button { width: 100%; }

  .session-header {
    height: 6.5rem;
    grid-template-columns: 1fr auto;
  }

  .session-timer {
    grid-row: 2;
    grid-column: 1 / -1;
    padding: 0.3rem 0.7rem;
  }

  .image-stage {
    height: calc(100vh - 13.6rem);
    padding: 0.75rem;
  }

  .session-controls {
    height: 6.75rem;
    flex-wrap: wrap;
    align-content: center;
  }

  .session-controls p {
    position: static;
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 420px) {
  .brand > span:last-child { font-size: 0.92rem; }
  h1 { font-size: 3.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.site-footer {
  width: min(calc(100% - 2rem), var(--page-width));
  margin: 0 auto;
  padding: 1rem 0 2rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}
.site-footer p { max-width: 48rem; margin: 0 auto; }

.custom-time:not([hidden]) { display: flex; gap: 0.6rem; }
.custom-time > span { flex: 1; min-width: 0; }
.custom-time label { display: block; margin-bottom: 0.3rem; font-size: 0.82rem; font-weight: 800; }
