/* Tema chiaro — palette logo: bianco, nero, verdino */
.draw-page {
  --mint: #83b7b2;
  --mint-soft: #e8f3f2;
  --mint-dark: #6a9d98;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f7faf9;
  --border: #e2ecea;
  --danger: #b42318;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, sans-serif;
  --header-h: 5.5rem;

  margin: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
}

.draw-page * {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

.site-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  z-index: 10;
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem 0.55rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.brand-logo {
  display: block;
  height: auto;
  max-height: 52px;
  max-width: min(280px, 78vw);
  width: auto;
  margin: 0 auto;
}

.brand-sub {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.draw-shell {
  flex: 1;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0.75rem 1.25rem 1rem;
  display: grid;
  grid-template-columns: minmax(260px, 320px) 1fr;
  gap: 1rem;
  align-items: end;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 8px 32px rgba(26, 26, 26, 0.06);
}

.panel-control {
  padding: 1.1rem 1.25rem 1.2rem;
}

.panel-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--ink);
}

.panel-lead {
  margin: 0.45rem 0 1rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.panel-lead-compact {
  margin-bottom: 0.85rem;
}

.control-card label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.select-wrap {
  position: relative;
  margin-bottom: 0.85rem;
}

.select-wrap::after {
  content: '';
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--mint-dark);
  border-bottom: 2px solid var(--mint-dark);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

#candidate {
  width: 100%;
  margin-bottom: 0;
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-size: 0.98rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#candidate:hover {
  border-color: var(--mint);
}

#candidate:focus {
  outline: none;
  border-color: var(--mint);
  box-shadow: 0 0 0 3px rgba(131, 183, 178, 0.35);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-block {
  width: 100%;
}

.btn-draw {
  padding: 0.82rem 1.15rem;
  font-size: 0.98rem;
  background: var(--mint);
  color: var(--ink);
  box-shadow: 0 4px 16px rgba(131, 183, 178, 0.45);
}

.btn-draw:hover:not(:disabled) {
  background: var(--mint-dark);
  color: #fff;
}

.btn-draw:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-draw:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-icon {
  font-size: 0.65rem;
}

.err {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 0.65rem 0 0;
}

.panel-result {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  align-self: stretch;
}

.result-header {
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.result-candidate {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--mint-dark);
  font-weight: 700;
}

.question-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-alt);
  border-radius: 14px;
  border: 2px solid var(--border);
  overflow: hidden;
  transition: border-color 0.35s, box-shadow 0.35s;
}

.question-stage.spinning {
  border-color: var(--mint);
  box-shadow: inset 0 0 0 1px rgba(131, 183, 178, 0.2);
}

.question-stage.reveal {
  border-color: var(--mint-dark);
  background: var(--mint-soft);
}

.question-stage-inner {
  flex: 1;
  min-height: 0;
  padding: 1.15rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
}

.stage-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  flex-shrink: 0;
}

.question-body {
  flex: 1;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
}

.question-stage.spinning .question-body {
  color: var(--muted);
  font-size: 0.95rem;
}

.question-stage.reveal .question-body {
  font-size: 1.05rem;
  color: var(--ink);
}

.progress-bar {
  height: 4px;
  background: var(--border);
  flex-shrink: 0;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--mint), var(--mint-dark));
  transition: width 0.08s linear;
}

/* ——— Login ——— */
.login-page {
  background: linear-gradient(165deg, var(--mint-soft) 0%, var(--bg) 42%, var(--bg) 100%);
}

.login-page .site-header {
  background: transparent;
  border-bottom-color: rgba(226, 236, 234, 0.85);
}

.login-page .brand-sub {
  color: var(--ink);
}

.login-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 1.25rem 1.5rem;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow:
    0 24px 48px rgba(26, 26, 26, 0.08),
    0 0 0 1px rgba(131, 183, 178, 0.12);
  overflow: hidden;
}

.login-card-accent {
  height: 5px;
  background: linear-gradient(90deg, var(--mint-dark), var(--mint), var(--mint-dark));
}

.login-card-body {
  padding: 1.75rem 1.65rem 1.85rem;
}

.login-eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mint-dark);
}

.login-title {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.login-lead {
  margin: 0.5rem 0 1.35rem;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--muted);
}

.login-form {
  margin: 0;
}

.login-field {
  margin-bottom: 1rem;
}

.login-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.login-field input {
  width: 100%;
  padding: 0.82rem 1rem;
  border-radius: 11px;
  border: 2px solid var(--border);
  background: var(--surface-alt);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.login-field input::placeholder {
  color: #9aa3a1;
}

.login-field input:hover {
  border-color: #cdded9;
}

.login-field input:focus {
  outline: none;
  border-color: var(--mint);
  background: var(--bg);
  box-shadow: 0 0 0 4px rgba(131, 183, 178, 0.28);
}

.login-submit {
  margin-top: 0.35rem;
}

@media (max-width: 900px) {
  .draw-page {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .draw-shell {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-bottom: 1.5rem;
  }

  .panel-control {
    align-self: auto;
  }

  .panel-result {
    min-height: 280px;
    max-height: none;
  }
}

@media (max-height: 720px) and (min-width: 901px) {
  .brand-logo {
    max-height: 44px;
  }

  .brand-sub {
    font-size: 0.78rem;
    margin-top: 0.25rem;
  }

  .draw-shell {
    padding-top: 0.5rem;
    padding-bottom: 0.65rem;
  }

  .panel {
    padding: 1rem 1.15rem;
  }

  .question-stage-inner {
    padding: 0.85rem 1rem;
  }
}
