:root {
  --bg: #f5f5f7;
  --ink: #1d1d1f;
  --muted: #86868b;
  --accent: #007aff;
  --accent-hover: #0051d5;
  --danger: #ff3b30;
  --success: #34c759;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.12);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Inter", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

.shell {
  width: min(560px, calc(100% - 3rem));
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 6rem) 0 4rem;
}

.brand-mark {
  margin: 0 0 3rem;
  text-align: center;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.03em;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) 0.1s forwards;
}

.panel,
.guide {
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.panel-form {
  padding: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) 0.2s forwards;
}

.form-hero {
  text-align: center;
  margin-bottom: 2.5rem;
}

.headline {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.lede {
  margin: 0 auto;
  color: var(--muted);
  font-size: 1rem;
  max-width: 42ch;
  font-weight: 400;
}

.field {
  display: grid;
  gap: 0.5rem;
}

.field span {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  padding-left: 0.25rem;
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1.125rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface-solid);
  outline: none;
  transition: all 0.3s var(--ease-out);
  min-height: 52px;
  box-shadow: var(--shadow-sm);
}

.field input::placeholder {
  color: rgba(0, 0, 0, 0.3);
  transition: opacity 0.3s var(--ease-out);
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.1),
              var(--shadow-sm);
  transform: translateY(-1px);
}

.field input:focus::placeholder {
  opacity: 0.5;
}

.field-link {
  margin-top: 1.5rem;
}

.link-block {
  margin: 1.5rem 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.5s var(--ease-out);
}

.link-block:not([hidden]) {
  opacity: 1;
  max-height: 200px;
}

.link-block[hidden] {
  display: none !important;
}

.hint {
  margin: 0.75rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

.hint code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.04);
  padding: 0.125em 0.375em;
  border-radius: 4px;
}

.action-row {
  margin-bottom: 1.5rem;
}

.field-code {
  min-width: 0;
}

.captcha-row {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.service-info {
  margin: 1.5rem 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.6s var(--ease-out);
  transform: translateY(-10px);
}

.service-info:not([hidden]) {
  opacity: 1;
  max-height: 400px;
  transform: translateY(0);
}

.service-info[hidden] {
  display: none !important;
}

.service-info-box {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}

.service-info-box h3 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.service-info-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.service-info-box li {
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  color: var(--ink);
  line-height: 1.5;
  position: relative;
  padding-left: 1.5rem;
}

.service-info-box li:last-child {
  margin-bottom: 0;
}

.service-info-box li::before {
  content: attr(data-emoji);
  position: absolute;
  left: 0;
  font-size: 1.125rem;
  line-height: 1;
}

.service-info-box li strong {
  font-weight: 600;
}

.submit-row {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.submit-row .btn {
  width: 100%;
  min-height: 52px;
}

.btn {
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 1.5rem;
  min-height: 52px;
  font: inherit;
  font-weight: 500;
  font-size: 1rem;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s var(--ease-out);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.2);
}

.btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 122, 255, 0.2);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.msg {
  margin: 1.5rem 0 0;
  font-size: 0.9375rem;
  text-align: center;
  font-weight: 500;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  opacity: 0;
  animation: fadeSlideUp 0.4s var(--ease-out) forwards;
  border: 1px solid transparent;
}

.msg:empty {
  display: none;
}

.msg.error {
  color: var(--danger);
  background: rgba(255, 59, 48, 0.06);
  border-color: rgba(255, 59, 48, 0.1);
}

.msg.ok {
  color: var(--success);
  background: rgba(52, 199, 89, 0.06);
  border-color: rgba(52, 199, 89, 0.1);
}

.msg.used {
  text-align: left;
  color: var(--ink);
  background: var(--surface-solid);
  border-color: var(--border);
  padding: 1.25rem 1.35rem;
}

.msg.used .msg-emoji {
  font-size: 1.5rem;
  line-height: 1;
  margin-bottom: 0.65rem;
}

.msg.used .msg-title {
  margin: 0 0 0.35rem;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.msg.used .msg-sub {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
}

.result {
  padding: clamp(2rem, 5vw, 2.5rem);
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) forwards;
}

.result-head {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.result-kicker {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--success);
  opacity: 0;
  animation: fadeIn 0.6s var(--ease-out) 0.2s forwards;
}

.result-title {
  margin: 0 0 0.75rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.03em;
  opacity: 0;
  animation: fadeSlideUp 0.6s var(--ease-out) 0.3s forwards;
}

.result-sub {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  opacity: 0;
  animation: fadeIn 0.6s var(--ease-out) 0.4s forwards;
}

.result-grid {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.result-grid > div {
  opacity: 0;
  animation: fadeSlideUp 0.6s var(--ease-out) forwards;
}

.result-grid > div:nth-child(1) {
  animation-delay: 0.5s;
}

.result-grid > div:nth-child(2) {
  animation-delay: 0.6s;
}

.result-grid > div:nth-child(3) {
  animation-delay: 0.7s;
}

.result-grid > div:nth-child(4) {
  animation-delay: 0.8s;
}

.result-grid .result-wide {
  grid-column: 1 / -1;
}

.result-grid dt {
  margin: 0 0 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--muted);
}

.result-grid dd {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  word-break: break-word;
  color: var(--ink);
}

.status-pill {
  display: inline-block;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
  font-size: 0.9375rem;
  font-weight: 500;
}

.guide {
  padding: 1.75rem 2rem 2rem;
  opacity: 0;
  animation: fadeSlideUp 0.8s var(--ease-out) 0.3s forwards;
}

.guide-head {
  margin-bottom: 1.5rem;
}

.guide-head h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.guide-head p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

.guide-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1rem;
  align-items: start;
}

.step-num {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(0, 122, 255, 0.1);
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  flex-shrink: 0;
}

.guide-steps h3 {
  margin: 0.125rem 0 0.375rem;
  font-size: 1.0625rem;
  font-weight: 500;
}

.guide-steps p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.foot {
  margin-top: 2rem;
  text-align: center;
}

.foot p {
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 820px) {
  .captcha-row {
    margin-bottom: 1.25rem;
  }

  .submit-row .btn {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 2rem, 560px);
    padding: 2rem 0 3rem;
  }

  .brand-mark {
    margin-bottom: 2rem;
  }

  .panel-form,
  .guide,
  .result {
    padding: 1.5rem;
  }

  .result-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .result-title {
    font-size: 1.5rem;
  }

  .headline {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
