:root {
  --page: #faf7f2;
  --text: #2c1f10;
  --accent: #7b4f2e;
  --secondary: #c8932a;
  --card: #fff9f2;
  --panel: #f0e6d6;
  --line: rgba(123, 79, 46, 0.25);
  --muted: #796753;
  --soft-line: rgba(123, 79, 46, 0.12);
  --shadow: 0 24px 44px rgba(123, 79, 46, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
  font-family: "Nunito Sans", sans-serif;
}

button,
input,
a {
  font: inherit;
}

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

button:focus-visible,
a:focus-visible,
.drop-zone:focus-visible,
.tree-button:focus-visible {
  outline: 3px solid rgba(200, 147, 42, 0.45);
  outline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 22px 0 0 max(16px, calc((100vw - 1500px) / 2));
  padding: 16px 24px;
  border-radius: 38px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.logo,
.script-note {
  font-family: "Caveat", cursive;
  font-weight: 500;
}

.logo {
  color: var(--accent);
  font-size: 3rem;
  line-height: 1;
}

.topbar span {
  color: var(--secondary);
  font-weight: 700;
}

.archive-shell {
  display: grid;
  grid-template-columns: minmax(340px, 0.72fr) minmax(620px, 1.28fr);
  gap: 28px;
  width: min(1500px, calc(100% - 48px));
  margin: 28px auto 44px;
}

.left-panel,
.right-panel {
  min-width: 0;
  padding: clamp(22px, 3vw, 42px);
  border-radius: 46px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.intro {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

h1 {
  max-width: 680px;
  margin: 0;
  color: var(--accent);
  font-family: "Inter", "Nunito Sans", sans-serif;
  font-size: clamp(2.45rem, 4.6vw, 4.8rem);
  font-weight: 700;
  line-height: 1;
}

.intro p {
  max-width: 610px;
  margin: 0;
  color: var(--muted);
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.55;
}

.archive-form {
  display: grid;
  gap: 18px;
}

.drop-zone {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 14px;
  min-height: 286px;
  padding: 34px;
  border: 2px dashed var(--line);
  border-radius: 44px;
  background: #fbf2e7;
  cursor: pointer;
}

.drop-zone.dragging {
  border-color: var(--secondary);
  background: #f7ecd9;
}

.drop-zone.locked {
  opacity: 0.62;
  pointer-events: none;
}

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

.archive-icon {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border-radius: 32px;
  background: var(--panel);
}

.archive-icon svg {
  width: 52px;
  height: 52px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drop-zone strong {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 800;
}

.script-note {
  color: var(--accent);
  font-size: 1.72rem;
  line-height: 1;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 14px 24px;
  color: var(--page);
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

.primary-button:hover {
  background: #6f4729;
}

.primary-button:disabled,
.primary-button.disabled {
  color: rgba(44, 31, 16, 0.46);
  background: #e8dac9;
  pointer-events: none;
  cursor: not-allowed;
}

.wide {
  width: 100%;
}

.file-card,
.progress-card,
.risk-banner,
.tree-panel,
.details-panel,
.findings-panel,
.error-card {
  border-radius: 40px;
  background: #fbf2e7;
}

.file-card {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.file-card > span,
.risk-banner span,
.panel-title span,
.findings-item span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.file-card > strong {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-size: 1.08rem;
}

dl {
  margin: 0;
}

.file-card dl,
.details-list {
  display: grid;
  gap: 10px;
}

.file-card dl {
  grid-template-columns: repeat(3, 1fr);
}

.file-card div,
.details-list div {
  display: grid;
  gap: 6px;
  min-width: 0;
}

dt {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-weight: 800;
}

.right-panel {
  display: grid;
  align-content: start;
  gap: 18px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 640px;
  border-radius: 44px;
  background: #fbf2e7;
  text-align: center;
}

.empty-state .script-note {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

.progress-card {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.progress-card div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.progress-card span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-weight: 700;
}

.progress-card strong {
  color: var(--accent);
}

.progress-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--card);
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--secondary);
  transition: none;
}

.result-view {
  display: grid;
  gap: 18px;
}

.risk-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px;
}

.risk-banner strong {
  color: var(--accent);
  font-size: clamp(1.4rem, 3vw, 2rem);
}

.risk-banner.notice strong {
  color: #8b6b12;
}

.risk-banner.warning strong {
  color: #9d5f19;
}

.risk-banner.danger strong {
  color: #8d2d1d;
}

.content-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  min-width: 0;
}

.tree-panel,
.details-panel,
.findings-panel {
  padding: 20px;
}

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

.panel-title strong {
  overflow-wrap: anywhere;
  color: var(--accent);
}

.findings-toggle {
  width: 100%;
  min-height: 52px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.findings-title-side {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.findings-chevron {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--card);
  font-size: 1.15rem;
  font-weight: 800;
  transition: transform 180ms ease;
}

.findings-toggle.open .findings-chevron {
  transform: rotate(180deg);
}

.tree {
  max-height: 430px;
  overflow: auto;
  padding-right: 6px;
}

.tree-children {
  display: grid;
  gap: 6px;
  margin-left: 18px;
}

.tree-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 20px;
  padding: 11px 14px;
  color: var(--text);
  background: rgba(255, 249, 242, 0.72);
  cursor: pointer;
  text-align: left;
}

.tree-button:hover,
.tree-button.selected {
  color: var(--page);
  background: var(--secondary);
}

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.tree-meta,
.risk-badge {
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--panel);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
}

.tree-button:hover .tree-meta,
.tree-button:hover .risk-badge,
.tree-button.selected .tree-meta,
.tree-button.selected .risk-badge {
  color: var(--accent);
  background: var(--page);
}

.risk-badge.notice {
  color: #8b6b12;
}

.risk-badge.warning {
  color: #9d5f19;
}

.risk-badge.danger {
  color: #9b3f32;
  background: #f4d8cf;
}

.tree-button:hover .risk-badge.danger,
.tree-button.selected .risk-badge.danger {
  color: #8e3328;
  background: #fff1eb;
}

.details-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 14px;
}

.details-list div {
  min-height: 78px;
  padding: 14px 16px;
  border: 1px solid var(--soft-line);
  border-radius: 24px;
  background: rgba(255, 249, 242, 0.66);
}

.details-list div:first-child {
  grid-column: 1 / -1;
}

.download-warning {
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: 22px;
  color: #8d2d1d;
  background: #f6dfd6;
  font-weight: 700;
}

.primary-button.confirming {
  background: #9b3f32;
  animation: confirmPulse 520ms ease;
}

@keyframes confirmPulse {
  0% {
    transform: scale(1);
  }

  45% {
    transform: scale(1.025);
  }

  100% {
    transform: scale(1);
  }
}

.findings-panel {
  display: grid;
  gap: 10px;
}

#findingsList {
  display: grid;
  gap: 10px;
  max-height: 260px;
  overflow: auto;
}

#findingsList[hidden] {
  display: none;
}

.findings-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 24px;
  background: var(--card);
}

.findings-item strong {
  color: var(--accent);
}

.findings-item p {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.findings-item .finding-meta {
  color: var(--text);
  font-size: 0.92rem;
}

.error-card {
  padding: 24px;
  color: #8d2d1d;
  font-weight: 800;
}

.hidden {
  display: none;
}

@media (max-width: 1120px) {
  .archive-shell,
  .content-layout {
    grid-template-columns: 1fr;
  }

  .empty-state {
    min-height: 320px;
  }
}

@media (max-width: 720px) {
  .archive-shell {
    width: min(100% - 28px, 1500px);
  }

  .left-panel,
  .right-panel,
  .file-card,
  .progress-card,
  .risk-banner,
  .tree-panel,
  .details-panel,
  .findings-panel {
    border-radius: 34px;
  }

  .drop-zone,
  .empty-state {
    border-radius: 34px;
  }

  .file-card dl,
  .details-list {
    grid-template-columns: 1fr;
  }

  .tree {
    max-height: 420px;
  }

  .tree-button {
    min-height: 50px;
  }
}
