:root {
  color-scheme: light;
  --navy: #172554;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #172033;
  --muted: #667085;
  --line: #dce3ed;
  --surface: rgba(255, 255, 255, 0.94);
  --shadow: 0 18px 45px rgba(31, 42, 68, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(96, 165, 250, 0.25), transparent 34rem),
    linear-gradient(160deg, #eff6ff 0%, #f8fafc 45%, #eef2ff 100%);
}

button,
input,
textarea {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(100% - 28px, 680px);
  margin: 0 auto;
  padding: max(36px, env(safe-area-inset-top)) 0 max(36px, env(safe-area-inset-bottom));
}

header {
  padding: 4px 4px 22px;
}

.eyebrow,
.step {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  color: var(--navy);
  font-size: clamp(2rem, 9vw, 3.1rem);
  line-height: 1.06;
  letter-spacing: -0.05em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card {
  margin-bottom: 14px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

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

label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.86rem;
  font-weight: 700;
}

.token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input {
  min-height: 48px;
  padding: 0 14px;
}

textarea {
  min-height: 100px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.18);
}

.hint,
.safety {
  color: var(--muted);
  font-size: 0.78rem;
}

.hint {
  margin: 9px 2px 0;
}

.badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
}

.badge.online {
  color: #05603a;
  background: #dcfae6;
}

.badge.offline {
  color: #7a2e0e;
  background: #ffead5;
}

.preset-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.command-button {
  display: flex;
  min-height: 128px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px;
  border: 0;
  border-radius: 18px;
  color: #172033;
  text-align: left;
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.42;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}

.command-button:active {
  transform: scale(0.975);
}

.command-button:disabled,
button:disabled {
  cursor: wait;
  filter: grayscale(0.3);
  opacity: 0.62;
}

.command-button:nth-child(4n + 1) { background: #fef3c7; }
.command-button:nth-child(4n + 2) { background: #dbeafe; }
.command-button:nth-child(4n + 3) { background: #fee2e2; }
.command-button:nth-child(4n + 4) { background: #ede9fe; }

.icon {
  font-size: 1.65rem;
}

.primary,
.secondary {
  border: 0;
  border-radius: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  min-height: 52px;
  padding: 0 20px;
  color: #fff;
  background: var(--blue);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.2);
}

.primary:hover {
  background: var(--blue-dark);
}

.secondary {
  min-width: 74px;
  padding: 0 16px;
  color: var(--blue-dark);
  background: #dbeafe;
}

.text-button,
.add-button,
.remove-preset {
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  font-weight: 800;
  cursor: pointer;
}

.text-button {
  flex: 0 0 auto;
  padding: 8px 2px;
  font-size: 0.84rem;
}

.preset-editor {
  padding-top: 2px;
}

.editor-help {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.preset-fields {
  display: grid;
  gap: 8px;
}

.preset-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  gap: 7px;
}

.preset-field input {
  min-width: 0;
}

.remove-preset {
  width: 40px;
  border-radius: 12px;
  color: #b42318;
  background: #fee4e2;
  font-size: 1.1rem;
}

.add-button {
  margin-top: 10px;
  padding: 8px 2px;
}

.editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 14px;
}

.editor-actions .primary,
.editor-actions .secondary {
  min-height: 46px;
}

.full {
  width: 100%;
  margin-top: 10px;
}

.count {
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.status {
  min-height: 24px;
  margin: 17px 6px 4px;
  color: var(--blue-dark);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 750;
}

.status.error {
  color: #b42318;
}

.safety {
  margin: 4px 6px 0;
  text-align: center;
}

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

@media (max-width: 430px) {
  .shell {
    width: min(100% - 20px, 680px);
  }

  .card {
    padding: 17px;
    border-radius: 19px;
  }

  .preset-grid {
    grid-template-columns: 1fr;
  }

  .command-button {
    min-height: 98px;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
