:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #e9eef8;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --toggle-bg: rgba(255, 255, 255, 0.78);
  --line: #dce4f0;
  --ink: #172033;
  --muted: #66758d;
  --green: #2fb878;
  --green-dark: #239765;
  --blue: #4f7cff;
  --blue-soft: #edf3ff;
  --violet: #7c5cff;
  --violet-soft: #f2efff;
  --gold: #c88c2d;
  --primary-ink: #ffffff;
  --book-ink: #ffffff;
  --rank-bg: #eaf8f1;
  --focus-ring: rgba(79, 124, 255, 0.16);
  --empty-thumb-text: rgba(255, 255, 255, 0.88);
  --shadow: 0 18px 42px rgba(45, 72, 122, 0.13);
  --body-bg:
    radial-gradient(circle at 12% 0%, rgba(79, 124, 255, 0.13), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(47, 184, 120, 0.11), transparent 24%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1110;
  --surface: #131d1a;
  --surface-2: #0f1715;
  --surface-3: #192622;
  --panel-bg: rgba(19, 29, 26, 0.9);
  --toggle-bg: rgba(19, 29, 26, 0.82);
  --line: #263831;
  --ink: #edf7ef;
  --muted: #98aaa0;
  --green: #46c885;
  --green-dark: #2ca66b;
  --blue: #69a7ff;
  --blue-soft: rgba(105, 167, 255, 0.14);
  --violet: #b6a4ff;
  --violet-soft: rgba(124, 92, 255, 0.16);
  --gold: #e0b765;
  --primary-ink: #06100c;
  --book-ink: #07111d;
  --rank-bg: rgba(70, 200, 133, 0.13);
  --focus-ring: rgba(31, 109, 70, 0.14);
  --empty-thumb-text: rgba(237, 247, 239, 0.82);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  --body-bg:
    radial-gradient(circle at 12% 4%, rgba(70, 200, 133, 0.22), transparent 28%),
    radial-gradient(circle at 78% 0%, rgba(105, 167, 255, 0.16), transparent 26%),
    linear-gradient(180deg, #0e1714 0%, var(--bg) 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--body-bg);
  color: var(--ink);
  font-family:
    "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.agent-shell {
  display: grid;
  gap: 24px;
  width: min(1240px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 26px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.brand-logo-link {
  display: inline-flex;
  border-radius: 0;
  text-decoration: none;
}

.brand-logo-link:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.brand-logo {
  display: block;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: 0 10px 28px rgba(45, 72, 122, 0.12);
}

h1 {
  font-size: 21px;
  line-height: 1.1;
}

.brand-row p,
.eyebrow,
.results-meta span,
.course-info p {
  color: var(--muted);
  font-size: 13px;
}

.language-toggle,
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--toggle-bg);
  padding: 4px;
}

.language-button,
.theme-button {
  min-width: 42px;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.theme-button {
  min-width: 58px;
}

.language-button.active,
.theme-button.active {
  background: var(--blue);
  color: #ffffff;
}

.language-button:not(.active):hover,
.theme-button:not(.active):hover {
  color: var(--blue);
}

.agent-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.prompt-card,
.examples-panel,
.understanding-panel,
.results-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--shadow);
}

.prompt-card {
  padding: 22px;
}

.eyebrow {
  margin-bottom: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.agent-form {
  display: grid;
  gap: 14px;
}

.prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: stretch;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 16px;
  outline: none;
  line-height: 1.45;
  font-size: 20px;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.prompt-actions {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  align-content: stretch;
}

.primary-button,
.ghost-button,
.toolbar-actions button,
.examples-panel button {
  min-height: 40px;
  border-radius: 8px;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--blue);
  color: var(--primary-ink);
  font-weight: 850;
  padding: 0 18px;
}

.prompt-actions .primary-button,
.prompt-actions .ghost-button {
  width: 100%;
}

.primary-button:hover {
  background: #3869eb;
}

.ghost-button,
.toolbar-actions button,
.examples-panel button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button {
  padding: 0 14px;
}

.button-icon {
  font-size: 18px;
  line-height: 1;
}

.examples-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px;
}

.examples-panel button {
  width: 100%;
  min-height: 48px;
  text-align: left;
  padding: 0 12px;
}

.examples-panel button:hover,
.toolbar-actions button:hover,
.toolbar-actions button.active,
.ghost-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.answer-grid {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.understanding-panel,
.results-panel {
  padding: 18px;
}

.intent-list {
  display: grid;
  gap: 10px;
}

.intent-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.intent-item:last-child {
  border-bottom: 0;
}

.intent-item span {
  color: var(--muted);
  font-size: 13px;
}

.intent-item strong {
  text-align: right;
  font-size: 14px;
}

.intent-item--warning {
  display: grid;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--violet) 26%, var(--line));
  border-radius: 8px;
  background: var(--violet-soft);
  padding: 10px;
}

.intent-item--warning strong {
  text-align: left;
  color: var(--ink);
  line-height: 1.35;
}

.results-header,
.results-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.results-header {
  margin-bottom: 12px;
}

.results-header h2 {
  font-size: 25px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar-actions button {
  padding: 0 12px;
}

.results-meta {
  align-items: center;
  margin-bottom: 14px;
}

.results-list {
  display: grid;
  gap: 12px;
}

.result-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.course-thumb {
  position: relative;
  display: grid;
  overflow: hidden;
  width: 100%;
  min-height: 104px;
  place-items: center;
  border-radius: 8px;
  background-color: var(--surface-3);
  background-position: center;
  background-size: cover;
}

.course-thumb--empty {
  background:
    linear-gradient(145deg, rgba(47, 184, 120, 0.62), rgba(79, 124, 255, 0.38)),
    radial-gradient(circle at 78% 20%, rgba(200, 140, 45, 0.36), transparent 18%),
    linear-gradient(180deg, #5d7dff 0%, #2fb878 100%);
}

.course-thumb--empty span {
  position: relative;
  z-index: 1;
  color: var(--empty-thumb-text);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.course-info {
  min-width: 0;
}

.course-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.rank {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: var(--rank-bg);
  color: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.course-info h3 {
  font-size: 18px;
}

.reason {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.tee-times {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.tee-times-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.tee-time-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tee-time-pill {
  display: inline-grid;
  gap: 2px;
  min-width: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--ink);
  padding: 8px 10px;
}

.tee-times--empty {
  border: 1px solid rgba(124, 92, 255, 0.28);
  border-radius: 8px;
  background: var(--violet-soft);
  color: var(--muted);
  padding: 10px 12px;
}

.tee-times--empty .tee-times-label {
  color: var(--violet);
}

.tee-time-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tee-time-pill strong {
  color: var(--blue);
  font-size: 15px;
}

.tee-time-pill span {
  color: var(--muted);
  font-size: 12px;
}

.flight-dots {
  display: inline-flex;
  gap: 3px;
}

.flight-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.flight-dots .available {
  background: var(--green);
}

.flight-dots .unavailable {
  background: #e25555;
}

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

.slot-row span {
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 13px;
  padding: 6px 8px;
}

.match-score {
  color: var(--green);
  font-weight: 850;
}

.book-column {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.price {
  font-size: 20px;
  font-weight: 850;
}

.book-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 126px;
  min-height: 40px;
  border-radius: 8px;
  background: var(--blue);
  color: var(--book-ink);
  font-weight: 850;
  text-decoration: none;
}

.book-link:hover {
  background: #8dbdff;
}

.empty-state {
  display: grid;
  gap: 6px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 18px;
}

.empty-state span {
  color: var(--muted);
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 18px;
}

.loading-state div {
  display: grid;
  gap: 4px;
}

.loading-state span {
  color: var(--muted);
}

.load-more-row {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.load-more-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--blue);
  font-weight: 850;
  padding: 0 18px;
}

.load-more-button:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.load-more-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.loader-ring {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  margin-top: 28px;
  padding: 18px 0 4px;
}

.site-footer a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

.site-footer a:hover {
  color: #8dbdff;
}

@media (max-width: 980px) {
  .agent-hero,
  .answer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .agent-shell {
    width: min(100vw - 24px, 1240px);
    padding-top: 16px;
  }

  .topbar,
  .results-header,
  .results-meta,
  .result-card {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  textarea {
    font-size: 17px;
  }

  .prompt-row {
    grid-template-columns: 1fr;
  }

  .prompt-actions {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
  }

  .book-column {
    justify-items: stretch;
  }

  .book-link {
    width: 100%;
  }

  .topbar-controls {
    justify-content: flex-start;
    width: 100%;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}
