:root {
  --accent: #c0392b;
  --accent-dark: #962d22;
  --bg: #f4f4f6;
  --card-bg: #ffffff;
  --text: #1a1a1a;
  --text-muted: #666;
  --border: #e0e0e0;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK",
    "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

.header {
  text-align: center;
  padding: 16px 0 8px;
}

.header h1 {
  font-size: 24px;
  color: var(--accent);
}

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

/* Search */
.search-container {
  position: relative;
  z-index: 1100;
  margin: 16px 0;
}

.search-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  transition: border-color 0.15s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 10;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.suggestion-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
  border-bottom: none;
}

.suggestion-item:hover,
.suggestion-item.active {
  background: #f7f0f0;
}

.suggestion-zh {
  font-size: 17px;
  font-weight: 600;
}

.suggestion-en {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.suggestion-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.suggestion-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
}

/* Address card */
.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px 20px 20px;
  margin: 16px 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  min-height: 160px;
  cursor: pointer;
}

.card-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.card-loading {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.map {
  height: 180px;
  margin: 0 0 16px;
  border-radius: 12px;
  overflow: hidden;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

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

.name-zh {
  font-size: 44px;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.name-en {
  font-size: 22px;
  color: var(--text-muted);
  word-break: break-word;
}

.street-zh {
  font-size: 24px;
  font-weight: 600;
  margin-top: 6px;
  word-break: break-word;
}

.street-en {
  font-size: 17px;
  color: var(--text-muted);
  word-break: break-word;
}

.district {
  font-size: 16px;
  color: var(--text-muted);
  word-break: break-word;
}

.status {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
}

.status.error {
  color: var(--accent);
}

.card-hint {
  margin-top: 12px;
  font-size: 12px;
  color: #aaa;
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.btn {
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 20px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.btn-secondary {
  background: var(--card-bg);
  color: var(--text);
  border: 2px solid var(--border);
}

/* Favorites */
.favorites {
  margin-top: 24px;
}

.favorites h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text-muted);
}

.favorites-list {
  list-style: none;
}

.favorite-item {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.favorite-item:active {
  background: #f7f0f0;
}

.favorite-zh {
  font-size: 18px;
  font-weight: 600;
}

.favorite-en {
  font-size: 13px;
  color: var(--text-muted);
}

.favorite-delete {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
}

/* Service support */
.support {
  margin: 28px 0 12px;
}

.support summary {
  list-style: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  text-align: center;
}

.support summary::-webkit-details-marker {
  display: none;
}

.support summary::after {
  content: " +";
}

.support[open] summary::after {
  content: " -";
}

.support-panel {
  background: var(--card-bg);
  border-radius: 12px;
  margin-top: 10px;
  padding: 16px;
  text-align: center;
}

.support-panel p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.support-link {
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-top: 8px;
  padding: 10px 12px;
  text-decoration: none;
}

.support-link:hover {
  background: var(--accent-dark);
}

/* Fullscreen overlay */
.fullscreen {
  position: fixed;
  inset: 0;
  background: var(--card-bg);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.fullscreen[hidden] {
  display: none;
}

.fullscreen-close {
  position: absolute;
  top: calc(12px + env(safe-area-inset-top, 0px));
  right: 16px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-content {
  text-align: center;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.fullscreen-name-zh {
  font-size: 72px;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.fullscreen-name-en {
  font-size: 36px;
  color: var(--text-muted);
  word-break: break-word;
}

.fullscreen-street-zh {
  font-size: 40px;
  font-weight: 600;
  word-break: break-word;
}

.fullscreen-street-en {
  font-size: 30px;
  color: var(--text-muted);
  word-break: break-word;
}

.fullscreen-district {
  font-size: 26px;
  color: var(--text-muted);
  word-break: break-word;
}

@media (max-width: 420px) {
  .fullscreen-name-zh {
    font-size: 56px;
  }
  .fullscreen-name-en {
    font-size: 28px;
  }
  .fullscreen-street-zh {
    font-size: 32px;
  }
  .fullscreen-street-en {
    font-size: 24px;
  }
  .fullscreen-district {
    font-size: 22px;
  }
}
