:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: #ffffff;
  --surface-hover: #fafafa;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --tertiary: #8e8e93;
  --line: rgba(0, 0, 0, 0.09);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #248a3d;
  --red: #d70015;
  --radius: 22px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.06);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
a,
.drop-zone {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.drop-zone:focus-within,
summary:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.34);
  outline-offset: 3px;
}

.app-shell {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 72px;
}

.app-shell.runner-shell {
  width: min(680px, calc(100% - 40px));
}

.brand-bar,
.page-nav {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 52px;
}

.brand {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.quiet-label {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 500;
}

.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 5px;
  margin-left: -10px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 550;
}

.back-link svg {
  width: 17px;
  height: 17px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(34px, 7vw, 48px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.page-header p {
  max-width: 590px;
  margin: 12px 0 0;
  color: var(--secondary);
  font-size: 17px;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.choice-list {
  display: grid;
  gap: 12px;
}

.choice-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 24px;
  min-height: 92px;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: background 180ms var(--ease), transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.choice-row:hover {
  background: var(--surface-hover);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 16px 38px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.choice-row:active {
  transform: scale(0.992);
}

.choice-icon {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 15px;
  background: var(--icon-bg, #e8f2ff);
  color: var(--icon-color, var(--blue));
}

.choice-icon svg {
  width: 25px;
  height: 25px;
}

.choice-copy {
  min-width: 0;
}

.choice-copy h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.choice-copy p {
  margin: 5px 0 0;
  color: var(--secondary);
  font-size: 14px;
  line-height: 1.45;
}

.choice-chevron {
  width: 20px;
  height: 20px;
  color: #b3b3b8;
}

.empty-state,
.error-state {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--secondary);
  line-height: 1.6;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.workflow li {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
  color: var(--tertiary);
  font-size: 13px;
  font-weight: 550;
}

.workflow li::before {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 50%;
  background: #e8e8ed;
  color: var(--secondary);
  content: attr(data-step);
  font-size: 12px;
  font-weight: 650;
}

.workflow li.active {
  color: var(--text);
}

.workflow li.active::before {
  background: var(--blue);
  color: white;
}

.workflow li.done::before {
  background: var(--green);
  color: white;
  content: "✓";
}

.runner-card {
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drop-zone {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  border: 1.5px dashed #b8b8bd;
  border-radius: 20px;
  background: #fbfbfd;
  cursor: pointer;
  text-align: center;
  transition: border-color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--blue);
  background: #f4f9ff;
}

.drop-zone.dragging {
  transform: scale(0.995);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-symbol {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #e8f2ff;
  color: var(--blue);
}

.upload-symbol svg {
  width: 28px;
  height: 28px;
}

.drop-zone strong {
  display: block;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.drop-zone small {
  display: block;
  margin-top: 7px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.45;
}

.file-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f5f5f7;
  font-size: 13px;
}

.file-row strong {
  overflow: hidden;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-row span {
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}

.feedback-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.feedback-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 11px;
  color: var(--secondary);
  font-size: 14px;
}

.feedback-dot {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 50%;
  background: #e8e8ed;
  color: var(--tertiary);
  font-size: 12px;
  font-weight: 700;
}

.feedback-item.working {
  color: var(--text);
}

.feedback-item.working .feedback-dot {
  border: 2px solid #d2d2d7;
  border-top-color: var(--blue);
  background: transparent;
  color: transparent;
  animation: spin 700ms linear infinite;
}

.feedback-item.success {
  color: var(--green);
}

.feedback-item.success .feedback-dot {
  background: var(--green);
  color: white;
}

.feedback-item.error {
  color: var(--red);
}

.feedback-item.error .feedback-dot {
  background: #ffe5e7;
  color: var(--red);
}

.access-settings {
  margin: 4px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.access-settings summary {
  min-height: 44px;
  padding: 12px 2px;
  color: var(--secondary);
  cursor: pointer;
  font-size: 13px;
  list-style: none;
}

.access-settings summary::-webkit-details-marker {
  display: none;
}

.access-settings summary::after {
  float: right;
  content: "+";
}

.access-settings[open] summary::after {
  content: "−";
}

.token-field {
  display: grid;
  gap: 7px;
  padding: 4px 0 16px;
  color: var(--secondary);
  font-size: 13px;
}

.token-field input {
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  border: 1px solid #c7c7cc;
  border-radius: 12px;
  background: white;
  color: var(--text);
  font-size: 16px;
}

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

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 650;
  transition: background 160ms var(--ease), opacity 160ms var(--ease), transform 160ms var(--ease);
}

.button:active {
  transform: scale(0.985);
}

.button.primary {
  background: var(--blue);
  color: white;
}

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

.button.secondary {
  background: #e8e8ed;
  color: var(--text);
}

.button.download {
  background: var(--green);
  color: white;
}

.button:disabled,
.button[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.38;
  pointer-events: none;
}

.clear-button {
  display: block;
  min-height: 44px;
  margin: 10px auto -8px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--secondary);
  cursor: pointer;
  font-size: 13px;
}

.clear-button:hover {
  color: var(--text);
}

[hidden] {
  display: none !important;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 560px) {
  .app-shell,
  .app-shell.runner-shell {
    width: min(100% - 24px, 760px);
    padding-top: 12px;
  }

  .brand-bar,
  .page-nav {
    margin-bottom: 36px;
  }

  .page-header h1 {
    font-size: 34px;
  }

  .page-header p {
    font-size: 15px;
  }

  .choice-row {
    grid-template-columns: 46px minmax(0, 1fr) 20px;
    min-height: 82px;
    gap: 13px;
    padding: 15px;
    border-radius: 18px;
  }

  .choice-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
  }

  .choice-copy h2 {
    font-size: 17px;
  }

  .choice-copy p {
    font-size: 13px;
  }

  .runner-card {
    padding: 18px;
    border-radius: 22px;
  }

  .drop-zone {
    min-height: 190px;
    padding: 22px 16px;
  }

  .workflow li {
    justify-content: center;
    font-size: 12px;
  }

  .workflow li::before {
    display: none;
  }

  .runner-actions {
    grid-template-columns: 1fr;
  }
}

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