:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #667085;
  --border: #d0d5dd;
  --primary: #16213e;
  --primary-hover: #22315c;
  --secondary: #eef2f7;
  --secondary-hover: #e4e9f2;
  --ok: #027a48;
  --warn: #b54708;
  --bad: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Segoe UI, system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem clamp(1rem, 3vw, 2.5rem);
  background: var(--primary);
  color: #fff;
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.brand-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .25);
}

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

h1 {
  margin-bottom: .1rem;
  font-size: clamp(1.35rem, 2.6vw, 2rem);
}

.app-header p {
  margin: 0;
  color: rgba(255, 255, 255, .82);
}

main {
  width: min(1180px, calc(100% - 2rem));
  margin: 1rem auto 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .06);
}

.intro {
  border-left: 6px solid var(--primary);
}

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

button {
  border: 0;
  border-radius: 12px;
  padding: .72rem 1rem;
  font-weight: 650;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .18);
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

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

button.secondary:hover:not(:disabled) {
  background: var(--secondary-hover);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  align-items: center;
}

.options label {
  display: flex;
  gap: .45rem;
  align-items: center;
}

.options input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .55rem .7rem;
  min-width: 140px;
}

.check {
  user-select: none;
}

.summary, .hint {
  color: var(--muted);
  margin-top: .8rem;
}

.results.empty {
  color: var(--muted);
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 14px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  margin-bottom: .85rem;
  background: #fff;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.file-title {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  border-radius: 999px;
  padding: .24rem .55rem;
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.ok {
  color: var(--ok);
  background: #ecfdf3;
}

.badge.bad {
  color: var(--bad);
  background: #fef3f2;
}

.badge.warn {
  color: var(--warn);
  background: #fffaeb;
}

.meta {
  color: var(--muted);
  font-size: .92rem;
  margin: .3rem 0 .7rem;
}

.preview {
  background: #f8fafc;
  border: 1px solid #eaecf0;
  border-radius: 12px;
  padding: .8rem;
  overflow: auto;
  max-height: 170px;
  white-space: pre-wrap;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: .92rem;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-top: .85rem;
}

.log {
  min-height: 120px;
  max-height: 320px;
  overflow: auto;
  background: #101828;
  color: #f2f4f7;
  border-radius: 14px;
  padding: .85rem;
  font-family: Consolas, "Cascadia Mono", "Courier New", monospace;
  font-size: .9rem;
  white-space: pre-wrap;
}

footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto 2rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .card-header {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
