:root {
  --bg: #0d0a1d;
  --card: #171330;
  --card-2: #1e1940;
  --line: #2f2958;
  --text: #ece9f7;
  --muted: #a7a1c8;
  --violet: #7b2fa0;
  --indigo: #3552c8;
  --cyan: #0a76a0;
  --ok: #55d9a8;
  --warn: #f2c14e;
  --bad: #ff8696;
  --focus: #9fc4ff;
  --radius: 14px;
  color-scheme: dark;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, 'Hiragino Sans', 'Yu Gothic', 'Noto Sans JP', sans-serif;
  -webkit-font-smoothing: antialiased;
}

.glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(52rem 34rem at 85% -8%, rgba(123, 47, 160, 0.34), transparent 62%),
    radial-gradient(46rem 32rem at -10% 8%, rgba(10, 118, 160, 0.26), transparent 58%);
}

.glow::after {
  content: '字幕';
  position: absolute;
  right: 4vw;
  bottom: 2vh;
  font-size: clamp(8rem, 24vw, 20rem);
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.025);
  user-select: none;
}

a {
  color: #b9c8ff;
  text-underline-offset: 0.18em;
}

a:hover {
  color: #fff;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shell {
  width: min(40rem, 100% - 1.5rem);
  margin: 0 auto;
  padding: clamp(0.9rem, 3vw, 2rem) 0 1.5rem;
  display: grid;
  gap: 0.8rem;
}

/* ---------- Header ---------- */

.hero {
  display: flex;
  gap: 0.9rem;
  align-items: center;
}

.logo {
  flex: none;
  border-radius: 14px;
  filter: drop-shadow(0 8px 20px rgba(123, 47, 160, 0.45));
}

h1 {
  margin: 0;
  font-size: clamp(1.4rem, 4.5vw, 1.8rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

/* ---------- The card and its steps ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--card-2), var(--card));
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.step {
  padding: 0.9rem 1.1rem 1rem;
}

.step + .step {
  border-top: 1px solid var(--line);
}

h2 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
}

.num {
  display: grid;
  place-items: center;
  flex: none;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--indigo) 55%, var(--cyan));
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.hint {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

label,
legend {
  display: block;
  margin: 0 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
}

.legend-note {
  color: var(--muted);
  font-weight: 400;
}

input[type='password'],
input[type='text'],
select {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f0c22;
  color: var(--text);
  font: inherit;
}

input::placeholder {
  color: #7b75a3;
}

input[readonly] {
  color: var(--muted);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.field {
  position: relative;
  flex: 1 1 14rem;
}

.field input {
  padding-right: 2.8rem;
}

.icon-button {
  position: absolute;
  top: 50%;
  right: 0.25rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transform: translateY(-50%);
}

.icon-button:hover,
.icon-button[aria-pressed='true'] {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.icon-button svg {
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.status {
  margin: 0.45rem 0 0;
  font-size: 0.9rem;
}

.status:empty {
  display: none;
}

.status[data-state='ok'] {
  color: var(--ok);
}

.status[data-state='bad'] {
  color: var(--bad);
}

.status[data-state='warn'] {
  color: var(--warn);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:hover {
  border-color: #50479a;
  background: rgba(255, 255, 255, 0.11);
  color: #fff;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--violet), var(--indigo) 55%, var(--cyan));
  color: #fff;
  font-weight: 700;
}

.btn.primary:hover {
  filter: brightness(1.12);
}

.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.actions .btn {
  flex: 1 1 8rem;
}

.actions .btn.primary {
  flex: 2 1 12rem;
}

/* ---------- Options ---------- */

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.2rem;
  align-items: flex-end;
}

.options fieldset {
  flex: 1 1 18rem;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0f0c22;
  overflow: hidden;
}

.seg label {
  position: relative;
  flex: 1;
  margin: 0;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.seg label + label {
  border-left: 1px solid var(--line);
}

.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.seg span {
  display: block;
  padding: 0.5rem 0.4rem;
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.seg label:hover span {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.seg label:has(input:checked) span {
  background: rgba(79, 91, 214, 0.3);
  color: #fff;
}

.seg label:has(input:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: -3px;
}

.max {
  flex: 0 0 auto;
}

select {
  appearance: none;
  width: 6rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 1.1rem) 1.05rem, calc(100% - 0.8rem) 1.05rem;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
}

/* ---------- Notes ---------- */

.note,
.warn {
  margin: 0.55rem 0 0;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.4;
}

.note {
  border: 1px solid rgba(15, 156, 201, 0.4);
  background: rgba(15, 156, 201, 0.1);
}

.warn {
  border: 1px solid rgba(242, 193, 78, 0.35);
  background: rgba(242, 193, 78, 0.08);
  color: #f3dfaa;
}

.faq {
  padding: 0.7rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.faq summary {
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
}

.faq ul {
  display: grid;
  gap: 0.55rem;
  margin: 0.8rem 0 0.2rem;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.foot {
  text-align: center;
  color: #7f79a6;
  font-size: 0.8rem;
}

.foot p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

@media (max-width: 30rem) {
  .hero {
    align-items: flex-start;
  }

  .step {
    padding: 0.8rem 0.9rem 0.9rem;
  }

  .legend-note {
    display: none;
  }

  .row .btn,
  .actions .btn.primary {
    flex: 1 1 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
