:root {
  color-scheme: light dark;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #5f6670;
  --border: #dde1e6;
  --accent: #4285f4;
  --accent-strong: #1a66d9;
  --accent-text: #ffffff;
  --button-bg: #eef2f7;
  --error: #c5221f;
  --success: #188038;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 5%);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16191d;
    --surface: #1f2328;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --border: #343a41;
    --accent: #8ab4f8;
    --accent-strong: #aecbfa;
    --accent-text: #0b1d3a;
    --button-bg: #2a3037;
    --error: #f28b82;
    --success: #81c995;
    --shadow: none;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.app {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
  display: grid;
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
}

.app-header img {
  border-radius: 10px;
  flex: none;
}

.app-header div {
  flex: 1;
  min-width: 0;
}

.app-header h1 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
}

.app-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

textarea {
  display: block;
  width: 100%;
  resize: vertical;
  min-height: 5.5rem;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: 0.95rem/1.4 ui-monospace, "SF Mono", Consolas, monospace;
  word-break: break-all;
}

textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.row .button {
  flex: 1;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s, transform 0.1s;
}

.button:active {
  transform: scale(0.98);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.button.primary:hover {
  background: var(--accent-strong);
}

.button.large {
  width: 100%;
  min-height: 56px;
  font-size: 1.1rem;
  margin-top: 12px;
}

.button.small {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 0.9rem;
}

.status {
  margin: -4px 4px;
  min-height: 1.5em;
  color: var(--muted);
  font-size: 0.95rem;
}

.status:empty {
  display: none;
}

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

.status.success {
  color: var(--success);
}

.result h2 {
  margin: 0;
  font-size: 1.15rem;
  overflow-wrap: anywhere;
}

.coords {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.95rem;
}

.notice {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--button-bg);
  color: var(--muted);
  font-size: 0.9rem;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.actions .span-2 {
  grid-column: 1 / -1;
}

.settings .toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-weight: 500;
  cursor: pointer;
}

.settings input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex: none;
  accent-color: var(--accent);
}

.hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

[hidden] {
  display: none !important;
}
