:root {
  --ink: #18221f;
  --muted: #64716c;
  --paper: #f4f1e9;
  --card: #fffefa;
  --line: #d9ddd7;
  --green: #176b52;
  --green-dark: #0d4d3b;
  --mint: #dff1e9;
  --coral: #ee5368;
  --shadow: 0 18px 45px rgba(26, 49, 41, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 0%, rgba(23, 107, 82, 0.1), transparent 28rem),
    var(--paper);
  font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  max-width: 1320px;
  margin: 0 auto;
  padding: 44px 28px 26px;
}

.eyebrow, .step {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1, h2 { margin: 0; letter-spacing: -0.04em; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; }
h2 { font-size: 1.45rem; }
.subtitle { margin: 12px 0 0; color: var(--muted); }

.privacy-badge {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 340px;
  padding: 15px 18px;
  color: white;
  background: var(--green-dark);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.header-tools { display: grid; justify-items: end; gap: 10px; }
.language-switch {
  display: inline-flex;
  padding: 3px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.language-switch button {
  min-width: 78px;
  padding: 7px 11px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 800;
}
.language-switch button[aria-pressed="true"] { color: white; background: var(--green); }

.privacy-badge .shield {
  display: grid;
  flex: 0 0 38px;
  height: 38px;
  place-items: center;
  color: var(--green-dark);
  background: #bfe9d9;
  border-radius: 50% 50% 55% 55%;
  font-weight: 900;
}

.privacy-badge span:last-child { display: grid; gap: 2px; }
.privacy-badge small { color: #cde5dc; font-size: 0.75rem; }

main { max-width: 1320px; margin: 0 auto; padding: 0 28px 56px; }

.privacy-panel {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 24px;
  margin-bottom: 18px;
  padding: 20px 24px;
  background: var(--mint);
  border: 1px solid #b9dbcd;
  border-radius: 16px;
}

.privacy-panel strong { color: var(--green-dark); }
.privacy-panel p { margin: 5px 0 0; color: #38554b; font-size: 0.9rem; line-height: 1.65; }
.network-note { padding-left: 24px; border-left: 1px solid #9fc8b8; }

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 0.78fr) minmax(600px, 1.5fr);
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(130, 143, 136, 0.25);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.settings, .results, .downloads { padding: 24px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.text-button {
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
}

.drop-zone {
  display: grid;
  place-items: center;
  margin: 24px 0;
  padding: 32px 20px;
  text-align: center;
  background: #f7faf7;
  border: 1.5px dashed #86ad9f;
  border-radius: 14px;
  transition: 160ms ease;
}

.drop-zone:hover, .drop-zone.dragging {
  background: var(--mint);
  border-color: var(--green);
  transform: translateY(-1px);
}

.drop-zone input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.drop-zone strong { margin: 12px 0 6px; }
.drop-zone span:not(.drop-icon) { color: var(--muted); font-size: 0.82rem; }
.drop-zone em { margin-top: 13px; color: var(--green); font-size: 0.78rem; font-style: normal; font-weight: 700; }
.drop-icon { display: grid; width: 48px; height: 48px; place-items: center; color: white; background: var(--green); border-radius: 50%; font-size: 1.8rem; }
.hidden-file-input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }
.file-picker-button {
  display: block;
  margin-top: -8px;
  padding: 10px 12px;
  color: var(--green-dark);
  background: var(--mint);
  border: 1px solid #b9dbcd;
  border-radius: 9px;
  text-align: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 800;
}
.file-picker-button::before { content: "↑"; margin-right: 8px; font-size: 1rem; }
.mobile-zip-upload { display: grid; gap: 9px; margin-top: -8px; padding: 13px; background: #f7faf8; border: 1px solid var(--line); border-radius: 11px; }
.mobile-zip-upload .file-picker-button { margin-top: 0; }
.mobile-zip-upload strong { color: var(--green-dark); font-size: 0.78rem; line-height: 1.55; }
.mobile-zip-upload ol { margin: 0; padding-left: 22px; color: var(--muted); font-size: 0.76rem; line-height: 1.65; }

.form-grid { display: grid; grid-template-columns: 1fr 120px; gap: 12px; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.form-grid .full-field { grid-column: 1 / -1; }
.boundary-field small { color: var(--muted); font-size: 0.74rem; font-weight: 500; line-height: 1.5; }
.boundary-status { color: var(--green); font-size: 0.76rem; line-height: 1.45; }
input, select {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
}
input:focus, select:focus { outline: 3px solid rgba(23, 107, 82, 0.15); border-color: var(--green); }

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 18px;
  padding-top: 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.77rem;
}
.source-row strong { color: var(--green); text-align: right; }

.count { padding: 6px 10px; color: var(--green); background: var(--mint); border-radius: 20px; font-size: 0.78rem; font-weight: 800; }
.empty-state { display: grid; grid-template-columns: repeat(3, 46px); justify-content: center; gap: 8px; margin-top: 92px; text-align: center; color: var(--muted); }
.empty-state span { display: grid; width: 46px; height: 46px; place-items: center; color: white; background: var(--coral); border: 3px solid white; border-radius: 50%; box-shadow: 0 3px 12px #c7c7c7; font-weight: 800; }
.empty-state span:nth-child(2) { transform: translateY(-16px); }
.empty-state p { grid-column: 1 / -1; font-size: 0.9rem; }

.table-wrap { max-height: 448px; margin-top: 18px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
thead { position: sticky; top: 0; z-index: 1; color: #53625d; background: #edf2ee; }
th, td { padding: 10px 9px; text-align: left; border-bottom: 1px solid #e7e9e6; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.label-dot { display: grid; width: 29px; height: 29px; place-items: center; color: white; background: var(--coral); border-radius: 50%; font-weight: 800; }
.file-name { display: block; max-width: 185px; overflow: hidden; text-overflow: ellipsis; }
.azimuth-input { min-width: 76px; min-height: 34px; padding: 5px 8px; }
.order-buttons { display: flex; gap: 3px; }
.order-buttons button { width: 28px; height: 28px; padding: 0; color: var(--green); background: white; border: 1px solid var(--line); border-radius: 6px; }

.action-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  margin-top: 18px;
  padding: 18px 22px;
}
#statusText { margin: 0 0 9px; color: var(--muted); font-size: 0.86rem; }
.action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.secondary-button { min-height: 48px; padding: 0 18px; color: var(--green-dark); background: var(--mint); border: 1px solid #8fc8b1; border-radius: 10px; font-weight: 800; }
#useCurrentLocationButton { display: none !important; }
.location-dialog { width: min(820px, calc(100% - 24px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32); }
.location-dialog::backdrop { background: rgba(7, 28, 22, 0.62); }
.location-panel { padding: 22px; }
.location-panel > p { color: var(--muted); font-size: 0.86rem; line-height: 1.6; }
.location-photo-name { color: var(--ink) !important; font-weight: 800; overflow-wrap: anywhere; }
#locationMap { display: block; width: 100%; height: auto; margin-top: 14px; background: #dfe6e1; border: 1px solid var(--line); border-radius: 12px; cursor: crosshair; touch-action: manipulation; }
.location-coordinates { color: var(--green-dark) !important; font-weight: 800; }
.location-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.progress-track { height: 5px; overflow: hidden; background: #e9ece9; border-radius: 10px; }
#progressBar { display: block; width: 0; height: 100%; background: var(--green); transition: width 180ms ease; }
.primary-button { min-height: 48px; padding: 0 22px; color: white; background: var(--green); border: 0; border-radius: 10px; font-weight: 800; box-shadow: 0 8px 18px rgba(23, 107, 82, 0.22); }
.primary-button:not(:disabled):hover { background: var(--green-dark); transform: translateY(-1px); }
.primary-button.is-generating { opacity: 1; background: #59766c; }
.primary-button.is-generating::before {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 9px;
  vertical-align: -2px;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: white;
  border-radius: 50%;
  animation: button-spin 0.8s linear infinite;
}

.downloads { margin-top: 18px; border: 2px solid transparent; }
.downloads > p { color: var(--muted); font-size: 0.9rem; }
.download-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.download-links a { padding: 10px 14px; color: var(--green-dark); background: var(--mint); border: 1px solid #b9dbcd; border-radius: 9px; text-decoration: none; font-weight: 800; }
.complete-heading { display: flex; align-items: center; gap: 10px; color: var(--green-dark); }
.complete-check {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: white;
  background: var(--green);
  border-radius: 50%;
  font-size: 1rem;
}
.downloads.is-ready {
  border-color: #40a77f;
  animation: result-highlight 1.8s ease-out 2;
}
.downloads.is-ready .complete-check { animation: result-check 500ms ease-out; }

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

@keyframes result-highlight {
  0% { box-shadow: 0 0 0 0 rgba(23, 107, 82, 0.5), var(--shadow); }
  45% { box-shadow: 0 0 0 10px rgba(23, 107, 82, 0.12), 0 22px 55px rgba(23, 107, 82, 0.25); }
  100% { box-shadow: 0 0 0 0 rgba(23, 107, 82, 0), var(--shadow); }
}

@keyframes result-check {
  0% { opacity: 0; transform: scale(0.5); }
  70% { transform: scale(1.15); }
  100% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .primary-button.is-generating::before,
  .downloads.is-ready,
  .downloads.is-ready .complete-check { animation: none; }
}

.showcase-banner {
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 28px;
  margin-top: 18px;
  padding: 28px;
  overflow: hidden;
  color: white;
  background:
    radial-gradient(circle at 5% 10%, rgba(126, 213, 178, 0.24), transparent 20rem),
    linear-gradient(135deg, #0d4d3b, #143c32);
}
.showcase-copy { align-self: center; }
.showcase-copy .step { color: #a9dfca; }
.showcase-copy h2 { max-width: 430px; font-size: clamp(1.65rem, 3vw, 2.4rem); line-height: 1.15; }
.showcase-copy > p:not(.step) { max-width: 480px; margin: 15px 0 20px; color: #cee2da; font-size: 0.92rem; line-height: 1.75; }
.showcase-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.showcase-tags span { padding: 7px 10px; color: #e4f3ed; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.17); border-radius: 20px; font-size: 0.72rem; font-weight: 800; }
.showcase-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; min-width: 0; }
.showcase-item { position: relative; min-width: 0; overflow: hidden; color: white; background: #102b24; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 13px; text-decoration: none; box-shadow: 0 16px 35px rgba(0, 0, 0, 0.24); }
.showcase-item img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 300ms ease; }
.showcase-item:hover img { transform: scale(1.035); }
.showcase-item > span { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 13px; }
.showcase-item strong { font-size: 0.85rem; }
.showcase-item small { color: #bdd6cc; text-align: right; }

.policy-section { margin-top: 18px; padding: 28px; }
.policy-heading { align-items: end; }
.policy-date { color: var(--muted); font-size: 0.78rem; }
.policy-intro { max-width: 850px; margin: 14px 0 22px; color: var(--muted); line-height: 1.7; }
.policy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.policy-grid details { background: #f8faf7; border: 1px solid var(--line); border-radius: 11px; }
.policy-grid summary { padding: 15px 17px; color: var(--green-dark); cursor: pointer; font-weight: 800; }
.policy-grid details[open] summary { border-bottom: 1px solid var(--line); }
.policy-content { padding: 4px 17px 14px; color: #465650; font-size: 0.87rem; line-height: 1.75; }
.policy-content p { margin: 10px 0 0; }

footer { display: flex; justify-content: center; gap: 22px; padding: 22px; color: #c7ddd4; background: var(--green-dark); text-align: center; font-size: 0.82rem; }
footer p { margin: 0; }
footer a { color: white; font-weight: 800; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
  .site-header, .privacy-panel { grid-template-columns: 1fr; }
  .site-header { align-items: stretch; flex-direction: column; }
  .header-tools { justify-items: stretch; }
  .language-switch { justify-self: end; }
  .privacy-badge { min-width: 0; }
  .network-note { padding: 12px 0 0; border-top: 1px solid #9fc8b8; border-left: 0; }
  .workspace { grid-template-columns: 1fr; }
  .results { min-height: 400px; }
  .showcase-banner { grid-template-columns: 1fr; }
  .policy-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-header { padding: 30px 18px 20px; }
  main { padding: 0 12px 36px; }
  .privacy-panel, .settings, .results, .downloads, .showcase-banner, .policy-section { padding: 18px; }
  .form-grid, .action-bar { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .showcase-gallery { grid-template-columns: 1fr; }
  .policy-heading { align-items: start; flex-direction: column; }
  footer { align-items: center; flex-direction: column; gap: 8px; }
}
