:root {
  --bg: #e9e9e6;
  --ink: #1f1f1f;
}

/* Text colors are limited to those Google allows for attribution. */
:root[data-level="low"] { --bg: #3dbb72; }
:root[data-level="medium"] { --bg: #f7c531; }
:root[data-level="high"] { --bg: #c62828; --ink: #ffffff; }

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--ink);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  background: var(--bg);
}

p { margin: 0; }

.bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.location {
  min-width: 0;
  font-size: 1rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

main {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 0;
}

.sample {
  align-self: flex-start;
  margin-bottom: 16px;
  padding: 4px 8px;
  border: 2px solid currentColor;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(3.5rem, 19vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  overflow-wrap: anywhere;
}

.driver {
  margin-top: 12px;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
}

.driver:empty { display: none; }

.notice {
  margin-top: 12px;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.button,
input {
  min-height: 48px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.button {
  padding: 0 20px;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

#retry {
  align-self: flex-start;
  margin-top: 20px;
}

.link {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 1rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

:is(button, input, a):focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 28px;
}

.picker label { font-weight: 600; }

.picker-row {
  display: flex;
  gap: 8px;
}

/* 16px or larger stops iOS from zooming the page when the field is focused. */
.picker input {
  flex: 1;
  min-width: 0;
  padding: 0 12px;
  background: #ffffff;
  color: #1f1f1f;
}

.picker-error { font-weight: 600; }

.picker .link { align-self: flex-start; }

.sources {
  display: grid;
  gap: 0;
  margin: 32px 0 0;
  padding: 0;
  border-top: 1px solid var(--ink);
  list-style: none;
}

.sources li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ink);
  font-size: 1.0625rem;
}

.sources .value { font-weight: 700; }

.updated {
  margin-top: 12px;
  font-size: 0.875rem;
}

footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.attribution {
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.4;
}

footer a { color: inherit; }

.attribution[translate="no"] { white-space: nowrap; }

/* Google's credit must stay visually separate from other sources. */
.attribution-other {
  padding-top: 8px;
  border-top: 1px solid var(--ink);
}

[hidden] { display: none !important; }
