* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: radial-gradient(circle at top, #d7f3d0 0%, #b0d8a9 35%, #1d3421 100%);
  color: #eff8ea;
}

.page {
  width: min(100%, 940px);
  padding: 28px;
  display: grid;
  gap: 28px;
  align-items: start;
}

.phone {
  width: 100%;
  max-width: 360px;
  border-radius: 40px;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, #29593c 0%, #1e3c2a 100%);
  border: 3px solid #8ec785;
  box-shadow: 0 32px 72px rgba(0, 0, 0, 0.45);
  position: relative;
  margin: 0 auto;
}

.phone::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 40px;
  pointer-events: none;
  background: radial-gradient(circle at top center, rgba(255,255,255,0.08), transparent 40%);
}

.phone-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.speaker {
  width: 80px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
}

.brand {
  font-family: 'Arial', sans-serif;
  color: #d3f3d4;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.25em;
}

.phone-screen {
  background: linear-gradient(180deg, #8ec785 0%, #4d7e55 20%, #203a2b 55%, #142818 100%);
  border-radius: 30px;
  padding: 18px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12), inset 0 10px 24px rgba(0,0,0,0.3);
}

.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #e5f6e6;
  margin-bottom: 12px;
}

.display-window {
  min-height: 180px;
  background: radial-gradient(circle at top, rgba(23, 60, 26, 0.95), rgba(11, 23, 11, 1) 70%);
  border: 2px solid rgba(142, 199, 133, 0.22);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 5px 12px rgba(0,0,0,0.35);
  color: #d9f0d4;
  font-family: 'Courier New', Courier, monospace;
  font-size: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.display-window .caret {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: #eaf7e8;
  vertical-align: bottom;
  margin-left: 1px;
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.display-window .char-pending {
  opacity: 0.4;
}

.display-window .char-correct {
  font-weight: 700;
  opacity: 1;
}

.display-window .char-incorrect {
  color: #ff6b6b;
  font-weight: 700;
  opacity: 1;
}

.screen-content {
  min-height: 130px;
}

.screen-hint {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(223, 248, 215, 0.15);
  color: #edf8e8;
  font-size: 13px;
  text-align: center;
}

.instructions {
  max-width: 560px;
  padding: 24px;
  border-radius: 26px;
  background: rgba(21, 42, 25, 0.96);
  border: 1px solid rgba(142,199,133,0.18);
  box-shadow: 0 18px 40px rgba(0,0,0,0.2);
}

.instructions h1 {
  margin: 0 0 10px;
  font-size: 22px;
  color: #e8f9e9;
}

.instructions p {
  margin: 10px 0;
  color: #cde5cd;
  line-height: 1.65;
}

#hiddenInput {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  border: none;
  outline: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  pointer-events: none;
}

.phone-screen {
  cursor: text;
}

.control-row {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.control-button {
  min-width: 120px;
  min-height: 48px;
  border: none;
  border-radius: 18px;
  background: linear-gradient(180deg, #92c687 0%, #3c7b4e 100%);
  color: #f4ffef;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 18px rgba(0,0,0,0.22);
  cursor: pointer;
  transition: transform 0.14s ease, filter 0.14s ease;
}

.control-button:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.control-button:active {
  transform: translateY(1px);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.65);
  z-index: 100;
  padding: 18px;
}

.modal-overlay.open {
  display: flex;
}

.modal-content {
  width: min(100%, 420px);
  background: rgba(13, 32, 20, 0.98);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  border: 1px solid rgba(142,199,133,0.14);
}

.modal-content h2 {
  margin: 0 0 12px;
  font-size: 22px;
  color: #e9f7ea;
}

.modal-content p {
  margin: 0 0 18px;
  color: #cbe5cc;
  line-height: 1.6;
}

.modal-content label {
  display: block;
  margin-bottom: 8px;
  color: #d9f0d2;
  font-size: 14px;
}

.modal-content input[type="email"] {
  width: 100%;
  border: 1px solid rgba(142,199,133,0.22);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.06);
  color: #f4f8ef;
  font-size: 15px;
  margin-bottom: 18px;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.control-button.secondary {
  background: rgba(255,255,255,0.12);
  color: #eef3ff;
}

.modal-status {
  margin: 0;
  color: #cddcff;
  min-height: 1.4em;
  font-size: 14px;
}

@media (max-width: 600px) {
  .page {
    padding: 14px;
    gap: 20px;
  }

  .phone {
    width: 100%;
    max-width: 340px;
    padding: 18px 14px 16px;
    border-radius: 34px;
  }

  .phone-screen {
    padding: 16px;
  }

  .display-window {
    min-height: 160px;
    padding: 12px;
  }

  .screen-hint {
    font-size: 12px;
    padding: 10px 12px;
  }

  .control-row {
    margin-top: 14px;
  }

  .control-button {
    min-width: 100px;
    min-height: 48px;
    font-size: 15px;
    border-radius: 16px;
  }

  .modal-content {
    padding: 22px;
  }

  .phone-button,
  .control-button {
    min-height: 52px;
    font-size: 16px;
  }
}
