:root {
  --white: #ffffff;
  --paper: #fafaf8;
  --ink: #1a1a1a;
  --ink-muted: #6b6b6b;
  --gold: #a07a28;
  --gold-glow: #c8a951;
  --border: #ececec;
  --radius: 20px;
  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 32px 24px;
}

.panel {
  grid-area: 1 / 1;
  min-width: 0;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 24px;
}

.panel[hidden] {
  display: none;
}

.eyebrow {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.title {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
  min-height: 1.2em;
}

.cursor {
  display: inline-block;
  width: 3px;
  height: 0.85em;
  margin-left: 2px;
  vertical-align: -0.1em;
  background: var(--gold);
  animation: blink 0.9s step-end infinite;
}

.cursor[hidden] {
  display: none;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

#code-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#code-form[hidden] {
  display: none;
}

.code-input::placeholder {
  color: var(--ink-muted);
  letter-spacing: 0.3em;
}

.code-input {
  width: 100%;
  padding: 18px 20px;
  font-family: inherit;
  font-size: 28px;
  letter-spacing: 0.15em;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}

.code-input:focus {
  outline: none;
  border-color: var(--gold-glow);
}

.btn-primary, .btn-secondary {
  padding: 16px 24px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.btn-primary {
  background: var(--gold);
  color: var(--white);
}

.btn-primary:active { transform: scale(0.97); }

.error-message {
  margin: 0;
  color: #b3261e;
  font-size: 14px;
}

.error-message.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.stage {
  position: relative;
  flex-shrink: 0;
  width: 100vw;
  max-width: none;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.die-canvas {
  position: absolute;
  inset: 0;
}

.die-canvas canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.result-symbol {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-symbol[hidden] {
  display: none;
}

.result-symbol svg {
  width: 100%;
  height: 100%;
  color: var(--gold);
}

.greeting {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
  max-width: 14ch;
}

.result-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  max-width: 32ch;
  color: var(--ink-muted);
}

#result-impuls {
  position: relative;
  padding-top: 20px;
  color: var(--ink);
  font-weight: 500;
}

#result-impuls::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--gold);
}

.cta-play {
  margin-top: 32px;
  text-decoration: none;
  display: inline-block;
  padding: 16px 32px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--white);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.cta-play:active {
  transform: scale(0.97);
}

.cta-play[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .btn-primary:active { transform: none; }
}
