:root {
  color-scheme: dark;
  --bg: #111310;
  --panel: #191c18;
  --panel-light: #20241f;
  --line: #343a32;
  --line-soft: #292e28;
  --text: #f2efe6;
  --muted: #a6aa9f;
  --accent: #d7ff64;
  --accent-soft: rgba(215, 255, 100, 0.1);
  --danger: #ff9d8f;
  --warning: #f2cc78;
  --success: #b8df87;
  --radius: 20px;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 72% 3%, rgba(215, 255, 100, 0.055), transparent 28rem),
    var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

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

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-weight: 720;
  font-size: 19px;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border: 7px solid var(--accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--bg);
}

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.privacy-badge > span:first-child { color: var(--success); font-size: 8px; }

.masthead-actions { display: flex; align-items: center; gap: 18px; }
.language-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.language-button {
  min-width: 46px;
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
}
.language-button[aria-pressed="true"] { color: var(--bg); background: var(--accent); font-weight: 750; }
.language-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.intro { padding: 78px 0 45px; }
.eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: 0.2em; }
.intro h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(32px, 5.2vw, 64px);
  line-height: 1.08;
  letter-spacing: -0.052em;
  font-weight: 680;
  white-space: nowrap;
}
html[lang="en"] .intro h1 { max-width: 880px; white-space: normal; }
.intro-copy { max-width: none; margin: 30px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }

.drop-zone {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 168px;
  padding: 34px 38px;
  border: 1px dashed #596052;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--panel), rgba(32, 36, 31, 0.72));
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
  cursor: pointer;
}
.drop-zone:hover, .drop-zone:focus-within, .drop-zone.is-dragging {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent-soft), var(--panel));
}
.drop-zone.is-dragging { transform: scale(1.006); }
.drop-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
}
.drop-icon span { position: relative; width: 26px; height: 22px; border: 2px solid var(--bg); border-radius: 4px; }
.drop-icon span::before {
  content: "";
  position: absolute;
  left: 50%; top: -10px;
  width: 2px; height: 18px;
  background: var(--bg);
  transform: translateX(-50%);
}
.drop-icon span::after {
  content: "";
  position: absolute;
  left: 50%; top: -10px;
  width: 8px; height: 8px;
  border-left: 2px solid var(--bg);
  border-top: 2px solid var(--bg);
  transform: translateX(-50%) rotate(45deg);
}
.drop-zone h2 { margin: 0 0 6px; font-size: 25px; letter-spacing: -0.025em; }
.drop-zone p { margin: 0; color: var(--muted); }
.text-button { padding: 0; border: 0; color: var(--accent); background: none; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; }
.format-note { max-width: 460px; justify-self: end; font-size: 12px; line-height: 1.6; text-align: right; }

.format-support {
  margin-top: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(25, 28, 24, 0.55);
}
.format-support summary { padding: 15px 18px; color: var(--text); font-size: 13px; font-weight: 650; cursor: pointer; }
.format-support-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line-soft);
  background: var(--line-soft);
}
.format-support-grid section { padding: 20px; background: var(--panel); }
.format-support-grid h2 { margin: 0 0 8px; color: var(--text); font-size: 13px; }
.format-support-grid p { margin: 0; font-size: 12px; line-height: 1.7; }

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

.status { margin-top: 18px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--muted); }
.status[data-type="error"] { color: var(--danger); border-color: rgba(255, 157, 143, 0.35); }
.status[data-type="warning"] { color: var(--warning); border-color: rgba(242, 204, 120, 0.35); }
.status[data-type="success"] { color: var(--success); }

.result { margin-top: 70px; }
.result-toolbar, .section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.result-toolbar { margin-bottom: 22px; }
.result-toolbar h2, .section-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -0.035em; overflow-wrap: anywhere; }
.secondary-button {
  flex: none;
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}
.secondary-button:hover { border-color: var(--accent); color: var(--accent); }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr); gap: 18px; }
.preview-frame, .file-panel, .metadata-panel, .gps-panel, .all-metadata-panel {
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--panel);
}
.preview-frame { display: grid; place-items: center; min-height: 420px; overflow: hidden; background: #0a0b0a; }
.preview-frame img, .preview-frame canvas { display: block; max-width: 100%; max-height: 620px; object-fit: contain; }
.preview-frame img { width: 100%; }
.preview-frame canvas { width: auto; height: auto; }
.preview-fallback { padding: 40px; color: var(--muted); text-align: center; line-height: 1.7; }
.file-panel { padding: 28px; }
.file-panel h3 { margin: 0 0 23px; font-size: 14px; color: var(--muted); font-weight: 650; }

.data-list, .metadata-grid { margin: 0; }
.data-list > div { padding: 15px 0; border-top: 1px solid var(--line-soft); }
.data-list dt, .metadata-grid dt { margin-bottom: 7px; color: var(--muted); font-size: 12px; }
.data-list dd, .metadata-grid dd { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }

.metadata-panel, .gps-panel { margin-top: 18px; padding: 34px; }
.section-heading { padding-bottom: 28px; border-bottom: 1px solid var(--line-soft); }
.section-note { margin: 0; color: var(--muted); font-size: 13px; }
.metadata-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metadata-grid > div { min-height: 103px; padding: 23px 24px 20px 0; border-bottom: 1px solid var(--line-soft); }
.metadata-grid > div:not(:nth-child(4n + 1)) { padding-left: 24px; border-left: 1px solid var(--line-soft); }
.metadata-grid dd { font-size: 18px; font-weight: 600; }
.metadata-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metadata-grid.compact > div:not(:nth-child(4n + 1)) { padding-left: 0; border-left: 0; }
.metadata-grid.compact > div:not(:nth-child(3n + 1)) { padding-left: 24px; border-left: 1px solid var(--line-soft); }

.apple-mode { display: flex; flex-wrap: wrap; gap: 18px; margin: 24px 0 0; padding: 0; border: 0; }
.apple-mode legend { width: 100%; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.apple-mode label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.apple-mode input { accent-color: var(--accent); }
.map-links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 28px; }
.map-link { display: block; padding: 14px 12px; border-radius: 12px; color: var(--bg); background: var(--accent); text-align: center; font-weight: 750; text-decoration: none; }
.map-link:hover { filter: brightness(0.9); }
.map-warning { margin: 15px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }

.all-metadata-panel { margin-top: 18px; overflow: hidden; }
.all-metadata-panel summary { padding: 22px 28px; cursor: pointer; font-weight: 650; }
.all-metadata-panel summary span { color: var(--muted); font-weight: 400; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line-soft); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 18px; border-bottom: 1px solid var(--line-soft); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 11px; letter-spacing: 0.08em; }
td:first-child { color: var(--accent); }
td:nth-child(2) { min-width: 190px; }
td:last-child { min-width: 280px; overflow-wrap: anywhere; }

footer { padding: 54px 0 38px; color: var(--muted); text-align: center; font-size: 12px; }
footer p { margin: 0; }
.visit-counter-trigger { position: relative; display: inline-block; outline: none; cursor: default; }
.visit-counter-trigger:focus-visible { outline: 1px solid var(--line); outline-offset: 4px; border-radius: 2px; }
.visit-counter-bubble {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(100% + 11px);
  width: max-content;
  max-width: min(260px, calc(100vw - 40px));
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-light);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  line-height: 1.45;
  transform: translateX(-50%);
  pointer-events: none;
}
.visit-counter-bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--panel-light);
  transform: translate(-50%, -4px) rotate(45deg);
}
.visit-counter-bubble[hidden] { display: none; }
.footer-credit { margin-top: 8px; }
.footer-credit a { color: inherit; text-decoration: none; }
.footer-credit a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 28px, 680px); }
  .masthead { min-height: 72px; }
  .privacy-badge { font-size: 11px; }
  .masthead-actions { gap: 10px; }
  .intro { padding: 58px 0 34px; }
  .drop-zone { grid-template-columns: auto 1fr; min-height: 148px; padding: 28px; }
  .format-note { grid-column: 2; justify-self: start; text-align: left; }
  .overview-grid { grid-template-columns: 1fr; }
  .format-support-grid { grid-template-columns: 1fr; }
  .preview-frame { min-height: 300px; }
  .metadata-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metadata-grid > div:not(:nth-child(4n + 1)) { padding-left: 0; border-left: 0; }
  .metadata-grid > div:not(:nth-child(2n + 1)) { padding-left: 20px; border-left: 1px solid var(--line-soft); }
  .metadata-grid.compact { grid-template-columns: 1fr; }
  .metadata-grid.compact > div { padding-left: 0 !important; border-left: 0 !important; }
  .map-links { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
  .brand { font-size: 17px; }
  .privacy-badge { display: none; }
  .language-button { min-width: 42px; padding-inline: 8px; }
  .intro h1 { font-size: clamp(24px, 7.4vw, 36px); letter-spacing: -0.045em; }
  .intro-copy { font-size: 15px; }
  .drop-zone { display: flex; flex-direction: column; align-items: flex-start; gap: 17px; padding: 25px; }
  .format-note { align-self: stretch; padding-top: 16px; border-top: 1px solid var(--line-soft); }
  .result { margin-top: 52px; }
  .result-toolbar, .section-heading { align-items: flex-start; flex-direction: column; }
  .metadata-panel, .gps-panel { padding: 25px; }
  .metadata-grid { grid-template-columns: 1fr; }
  .metadata-grid > div { padding-left: 0 !important; border-left: 0 !important; }
  .map-links { grid-template-columns: 1fr; }
}

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