:root {
  --mcd-red: #da291c;
  --mcd-yellow: #ffc72c;
  --bg: #f5f3ef;
  --card: #ffffff;
  --text: #27251f;
  --muted: #6b6b6b;
  --border: #e8e4dc;
  --success: #1a7f4b;
  --shadow: 0 8px 30px rgba(39, 37, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #fff9e6 0%, var(--bg) 220px);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px 20px 8px;
  max-width: 900px;
  margin: 0 auto;
}

.logo {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--mcd-red);
  color: var(--mcd-yellow);
  font-weight: 800;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  display: grid;
  gap: 16px;
}

.top-card {
  padding: 16px 18px;
}

.top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}

.location-panel h2,
.tip-panel h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.location-panel {
  min-width: 0;
}

.tip-panel {
  min-width: 0;
  border-left: 1px solid var(--border);
  padding-left: 20px;
  display: flex;
  align-items: center;
}

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

.card h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
}

.location-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  font: inherit;
  cursor: pointer;
}

#use-location-btn,
.primary-btn {
  background: var(--mcd-red);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
}

#use-location-btn:hover,
.primary-btn:hover:not(:disabled) {
  filter: brightness(1.05);
}

.primary-btn:disabled {
  background: #d8d4cc;
  color: #7a7570;
  cursor: not-allowed;
}

.search-hint {
  margin: 10px 0 0;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--mcd-red);
  font-weight: 600;
}

.link-btn {
  background: none;
  border: none;
  color: var(--mcd-red);
  padding: 0;
  font-weight: 600;
}

.status-text {
  color: var(--muted);
  font-size: 0.95rem;
}

.coords {
  margin-top: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.radius-row {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.radius-row label {
  font-size: 0.95rem;
  color: var(--text);
}

#radius-input {
  width: 5rem;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
}

#item-search {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
}

.item-results {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 280px;
  overflow: auto;
}

.item-option {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

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

.item-option:hover,
.item-option.active {
  background: #fff7d6;
}

.item-option small {
  color: var(--muted);
}

.selected-item {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff7d6;
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.primary-btn {
  margin-top: 14px;
  width: 100%;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.results-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sort-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.sort-select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sort-select:focus {
  outline: 2px solid #f2d56d;
  outline-offset: 1px;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.best-deal {
  margin: 14px 0;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fff4c2, #ffe08a);
  border: 1px solid #f2d56d;
}

.best-deal .price {
  font-size: 2rem;
  font-weight: 800;
  color: var(--mcd-red);
}

.result-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row a {
  color: var(--mcd-red);
  font-weight: 600;
  text-decoration: none;
}

.result-row a:hover {
  text-decoration: underline;
}

.result-price {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: right;
}

.result-meta {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  color: var(--muted);
}

.stale-badge {
  display: inline-block;
  background: #f0f0f0;
  color: #666;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.75rem;
  margin-left: 6px;
}

.tip-panel-inner {
  width: 100%;
  height: 108px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  flex: 1;
  min-height: 0;
}

.tip-code-box {
  width: 96px;
  height: 84px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  background: #fff;
  color: var(--mcd-red);
  border: 2px solid var(--mcd-red);
  border-radius: 12px;
  font: inherit;
  padding: 8px;
  text-align: center;
  cursor: pointer;
}

.tip-code-display {
  display: block;
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
}

.tip-code-box.is-revealed .tip-code-display,
.tip-code-box:disabled .tip-code-display {
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.tip-code-box:hover:not(:disabled):not(.is-revealed) {
  background: #fff5f4;
}

.tip-code-box.is-revealed,
.tip-code-box:disabled {
  cursor: default;
  background: #fff5f4;
}

.tip-text {
  flex: 1;
  min-width: 0;
}

.tip-heading {
  margin: 0;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.25;
}

.tip-detail {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.tip-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: right;
  align-self: flex-end;
  flex-shrink: 0;
  height: 1.2em;
}

.tip-meta:empty {
  visibility: hidden;
}

.secondary-btn {
  background: #fff;
  color: var(--mcd-red);
  border: 2px solid var(--mcd-red);
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn:hover {
  background: #fff5f4;
}

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

.error-banner {
  background: #fde8e8;
  color: #8b1a1a;
  border: 1px solid #f5b5b5;
  border-radius: 12px;
  padding: 12px 16px;
}

footer.site-footer {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-joke {
  margin: 0;
  font-size: 0.82rem;
  opacity: 0.85;
}

.footer-note {
  margin: 0;
}

.footer-social {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-social a {
  color: var(--mcd-red);
  font-weight: 600;
  text-decoration: none;
}

.footer-social a:hover {
  text-decoration: underline;
}

.footer-dot {
  opacity: 0.5;
}

@media (max-width: 640px) {
  .top-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .tip-panel {
    border-left: none;
    padding-left: 0;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }
}

@media (max-width: 600px) {
  .result-row {
    grid-template-columns: 1fr;
  }

  .result-price {
    text-align: left;
  }
}
