* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

:root {
  color-scheme: light;
  --page-bg: #eef3f1;
  --panel-bg: #fcfcf8;
  --border: #c8d3cf;
  --text: #1d2523;
  --muted: #56615d;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --error: #b91c1c;
  --success: #15803d;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.app-shell {
  display: grid;
  gap: 16px;
  width: min(728px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.panel {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.primary-panel {
  padding-top: 24px;
}

.back-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 30px;
  margin-bottom: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent-strong);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.back-button:hover,
.back-button:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p,
dd {
  margin: 0;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.intro {
  max-width: 760px;
  margin-top: 12px;
  color: var(--muted);
}

.result-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.output-stack {
  display: grid;
  gap: 16px;
  min-width: 0;
}

button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover:enabled,
button:focus-visible:enabled {
  background: var(--accent-strong);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.wide-button {
  width: 100%;
}

select {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

select:disabled {
  color: var(--muted);
  background: #eef0ee;
}

.field-label {
  display: block;
  margin-top: 18px;
  font-weight: 700;
}

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

.section-heading > :first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.section-heading + .wide-button {
  margin-top: 16px;
}

.section-note {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f7f6;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
}

.section-note.is-neutral {
  border-color: var(--border);
  background: #f5f7f6;
  color: var(--muted);
}

.section-note.is-warning {
  border-color: #fdba74;
  background: #fff7ed;
  color: var(--warn);
}

.section-note.is-error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: var(--error);
}

.section-note.is-success {
  border-color: #86efac;
  background: #f0fdf4;
  color: var(--success);
}

.facts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 16px 0 0;
}

.facts dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.facts dd {
  margin-top: 4px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.log-list {
  margin: 16px 0 0;
  padding-left: 20px;
}

.package-block {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.nwjs-panel {
  background: #fff8e1;
  border-color: #f4df9e;
  box-shadow: none;
}

.nwjs-panel .package-block {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.download-copy {
  margin-bottom: 12px;
  color: var(--muted);
}

.nwjs-panel .download-copy,
.nwjs-panel .manual-steps {
  color: #625634;
}

.download-link {
  margin-bottom: 12px;
}

.download-link a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--accent-strong);
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.download-link a:hover,
.download-link a:focus-visible {
  background: var(--accent-strong);
}

.manual-steps {
  margin: 0;
  padding-left: 20px;
}

.manual-steps li + li {
  margin-top: 8px;
}

.log-entry + .log-entry {
  margin-top: 8px;
}

.log-entry.info {
  color: var(--muted);
}

.log-entry.warning {
  color: var(--warn);
}

.log-entry.error {
  color: var(--error);
}

.log-entry.success {
  color: var(--success);
}

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

@media (min-width: 920px) {
  .details-panel,
  .output-panel {
    min-height: 294px;
  }

  .app-shell {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .back-button,
  .primary-panel,
  .activity-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100vw - 20px, 728px);
    padding-top: 12px;
  }

  .panel {
    padding: 16px;
  }

  .result-actions {
    gap: 12px;
  }

  button {
    width: 100%;
  }
}
