:root {
    --cream: #f6f3e9;
    --paper: #fffdf7;
    --ink: #253b32;
    --muted: #69766b;
    --pond: #315e4a;
    --pond-dark: #234735;
    --pond-light: #e6eee4;
    --blue: #b8d5d7;
    --yellow: #e6b84d;
    --line: #dedfd2;
    --red: #a94f3f;
    --success: #286344;
    --danger: #9c392e;
    --font: "Nunito Sans", system-ui, sans-serif;
    --radius: 18px;
    --shadow: 0 12px 36px rgba(37, 59, 50, .08);
}

/* ===== Global styles ===== */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 90px;
}

body {
    margin: 0;
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.65;
}

body,
input,
button,
select {
    font-family: var(--font);
}

button,
input,
select {
    font-size: inherit;
}

button,
a,
select {
    -webkit-tap-highlight-color: transparent;
}

button {
    color: inherit;
}

a {
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

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

h1,
h2,
h3 {
    line-height: 1.13;
    letter-spacing: -.035em;
}

h1 {
    font-size: clamp(3.1rem, 7vw, 6rem);
    font-weight: 900;
}

h2 {
    font-size: clamp(2.2rem, 4.2vw, 3.65rem);
    font-weight: 900;
}

h3 {
    font-size: 1.35rem;
    font-weight: 800;
}

em {
    color: var(--pond);
    font-style: normal;
}

.hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    z-index: 100;
    top: -100px;
    left: 16px;
    padding: 10px 14px;
    background: var(--ink);
    color: white;
    border-radius: 8px;
}

.skip-link:focus {
    top: 12px;
}

:focus-visible {
    outline: 3px solid #bc7d17;
    outline-offset: 3px;
}

/* ===== Header and brand ===== */

.site-header {
    width: min(1200px, calc(100% - 64px));
    min-height: 82px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-bottom: 1px solid rgba(37, 59, 50, .13);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 900;
    letter-spacing: -.04em;
    white-space: nowrap;
}

.brand-mark {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    border-radius: 0;
    box-shadow: none;
}


.site-header .brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    line-height: 1;
}

.site-header .brand-mark {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
}

.site-header .brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}


.brand-dot {
    color: #c58c2c;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: clamp(14px, 2.5vw, 32px);
}

.main-nav a {
    color: #526359;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 800;
    transition: color .15s ease;
}

.main-nav a:hover {
    color: var(--pond);
}

.nav-chat-btn {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 10px 17px;
    background: var(--paper);
    font-size: .86rem;
    font-weight: 800;
    cursor: pointer;
}

.nav-chat-btn:hover {
    border-color: var(--pond);
    color: var(--pond);
}

/* ===== Hero ===== */

.hero {
    width: min(1200px, calc(100% - 64px));
    margin: auto;
    min-height: 580px;
    padding: 82px 0 78px;
    display: grid;
    grid-template-columns: 1.02fr .98fr;
    align-items: center;
    gap: 45px;
}

.hero-copy {
    max-width: 600px;
}

.eyebrow {
    margin-bottom: 17px;
    color: var(--pond);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .15em;
}

.eyebrow-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    background: var(--yellow);
    border-radius: 50%;
}

.hero h1 {
    margin-bottom: 22px;
}

.hero h1 em {
    position: relative;
}

.hero-description {
    max-width: 510px;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 29px;
}

.button {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 900;
    cursor: pointer;
    transition:
        background .15s ease,
        transform .15s ease,
        border-color .15s ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    background: var(--pond);
    color: white;
}

.button-primary:hover {
    background: var(--pond-dark);
}

.button-outline {
    border-color: #c9d0c4;
    background: transparent;
}

.button-outline:hover {
    background: var(--paper);
    border-color: var(--pond);
}

.button-light {
    background: var(--cream);
    color: var(--ink);
}

.button-light:hover {
    background: white;
}

.button-full {
    width: 100%;
    margin-top: 18px;
}

.hero-note {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 34px;
}

.hero-note p {
    margin: 0;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.hero-note-line {
    width: 28px;
    height: 2px;
    background: var(--yellow);
}

/* ===== Hero image ===== */

.hero-art {
    min-width: 0;
    position: relative;
    padding: 22px 24px 25px 12px;
}

.hero-image-frame {
    position: relative;
    overflow: hidden;
    min-height: 360px;
    aspect-ratio: 1.03 / 1;
    background: #d8e4d7;
    border-radius: 44% 44% 16px 16px;
}

.hero-image-frame img {
    width: 100%;
    height: 100%;
    min-height: 360px;
    position: absolute;
    inset: 0;
    object-fit: cover;
}

.hero-image-frame.image-fallback {
    background: linear-gradient(
        160deg,
        #d7e6df 0 50%,
        #9dbeb0 50% 67%,
        #719784 67%
    );
}

.image-caption {
    position: absolute;
    bottom: 16px;
    left: 16px;
    right: 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: rgba(255, 253, 247, .94);
    border-radius: 8px;
    font-size: .79rem;
    font-weight: 900;
}

.caption-dot {
    width: 8px;
    height: 8px;
    background: var(--pond);
    border-radius: 50%;
}

.caption-scientific {
    color: var(--muted);
    font-size: .73rem;
    font-weight: 600;
    font-style: italic;
}

.floating-note {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    background: var(--paper);
    border: 1px solid rgba(37, 59, 50, .1);
    border-radius: 8px;
    box-shadow: var(--shadow);
    font-size: .76rem;
    font-weight: 900;
}

.note-top {
    top: 42px;
    right: -8px;
}

.note-top span {
    color: var(--pond);
    font-size: 1rem;
}

.note-bottom {
    bottom: 5px;
    left: -4px;
}

.note-sun {
    color: #bb871e;
    font-size: 1.1rem;
}

.hero-decoration {
    position: absolute;
    z-index: -1;
    color: var(--yellow);
    font-size: 2.8rem;
}

.decoration-one {
    left: -16px;
    top: 12px;
    transform: rotate(-20deg);
}

.decoration-two {
    right: -12px;
    bottom: 70px;
    font-size: 1.8rem;
}

/* ===== Intro strip ===== */

.intro-strip {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 22px 24px;
    background: var(--pond);
    color: white;
}

.intro-strip > div {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px clamp(16px, 4vw, 52px);
    font-size: .86rem;
    font-weight: 800;
}

.intro-strip > div + div {
    border-left: 1px solid rgba(255, 255, 255, .25);
}

.strip-number {
    color: #f0d18b;
    font-size: .72rem;
    letter-spacing: .1em;
}

/* ===== Section layouts ===== */

.section {
    width: min(1120px, calc(100% - 64px));
    margin: auto;
}

.species-section,
.quiz-section {
    padding-top: 105px;
    padding-bottom: 105px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 35px;
    margin-bottom: 35px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.section-description {
    max-width: 350px;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: .96rem;
}

/* ===== Species explorer ===== */

.explorer-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 14px;
    background: #eeeee3;
    border-radius: 10px;
}

.search-box {
    display: flex;
    align-items: center;
    flex: 1 1 280px;
    gap: 10px;
    padding: 0 13px;
    min-height: 45px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.search-box > span:first-child {
    color: var(--pond);
    font-size: 1.65rem;
    line-height: 1;
}

.search-box input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ink);
}

.search-box input:focus-visible {
    outline: 0;
}

.filter-label {
    font-size: .8rem;
    color: var(--muted);
    font-weight: 800;
}

#species-filter {
    min-height: 45px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--paper);
    color: var(--ink);
    font-weight: 800;
}

.results-count {
    margin: 19px 0 13px;
    color: var(--muted);
    font-size: .8rem;
    font-weight: 800;
}

.species-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.species-card {
    min-width: 0;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    transition:
        transform .18s ease,
        box-shadow .18s ease;
}

.species-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.species-image {
    height: 174px;
    overflow: hidden;
    background: var(--pond-light);
}

.species-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .25s ease;
}

.species-card:hover .species-image img {
    transform: scale(1.035);
}

.species-image.image-fallback {
    display: grid;
    place-items: center;
    background: linear-gradient(140deg, #dce9de, #a9c7b5);
    color: var(--pond);
    font-size: 2.5rem;
}

.species-content {
    padding: 17px 16px 18px;
}

.species-category {
    margin-bottom: 8px;
    color: var(--pond);
    font-size: .66rem;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.species-content h3 {
    margin-bottom: 3px;
    font-size: 1.16rem;
}

.scientific-name {
    margin-bottom: 13px;
    color: var(--muted);
    font-size: .76rem;
    font-style: italic;
}

.species-short {
    margin-bottom: 15px;
    color: #536358;
    font-size: .83rem;
    line-height: 1.55;
}

.species-details {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.species-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    color: var(--pond);
    font-size: .8rem;
    font-weight: 900;
    list-style: none;
}

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

.species-details summary::after {
    content: "+";
    font-size: 1.1rem;
}

.species-details[open] summary::after {
    content: "−";
}

.species-details p {
    margin: 12px 0 0;
    color: #536358;
    font-size: .81rem;
}

.species-details strong {
    color: var(--ink);
}

.empty-state {
    padding: 40px 12px;
    text-align: center;
    color: var(--muted);
}

/* ===== Ask Quack section ===== */

.ask-section {
    padding: 88px max(32px, calc((100% - 1120px) / 2));
    background: var(--pond);
    color: white;
    display: grid;
    grid-template-columns: 1fr .9fr;
    align-items: center;
    gap: 70px;
}

.ask-copy .eyebrow {
    color: #e7cb88;
}

.ask-copy h2 {
    margin-bottom: 23px;
}

.ask-copy h2 em {
    color: #d8e6ce;
}

.ask-copy > p:not(.eyebrow) {
    max-width: 530px;
    color: #e0e9df;
}

.ask-points {
    list-style: none;
    padding: 0;
    margin: 26px 0 30px;
}

.ask-points li {
    display: flex;
    gap: 10px;
    margin: 10px 0;
    color: #edf2e9;
    font-size: .88rem;
}

.ask-points li span {
    color: #f0d18b;
    font-weight: 900;
}

.chat-preview {
    overflow: hidden;
    background: var(--paper);
    border-radius: 12px;
    color: var(--ink);
    box-shadow: 0 20px 50px rgba(0, 0, 0, .12);
}

.preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 19px;
    border-bottom: 1px solid var(--line);
}

.preview-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Logo images: no circular background or clipping. */
.preview-avatar,
.chat-avatar {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
}

.preview-avatar img,
.chat-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.chat-avatar {
    width: 35px;
    height: 35px;
}

.preview-brand strong,
.preview-brand small,
.chat-title strong,
.chat-title small {
    display: block;
}

.preview-brand strong,
.chat-title strong {
    font-size: .9rem;
}

.preview-brand small,
.chat-title small {
    color: var(--muted);
    font-size: .7rem;
}

.online-status {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
}

.online-status span {
    width: 7px;
    height: 7px;
    background: #5c9a6d;
    border-radius: 50%;
}

.preview-conversation {
    padding: 23px;
}

.preview-label {
    margin-bottom: 12px;
    color: var(--muted);
    font-size: .65rem;
    font-weight: 900;
    letter-spacing: .13em;
}

.suggestion {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    padding: 12px 14px;
    background: #f0f2e8;
    border: 1px solid transparent;
    border-radius: 7px;
    text-align: left;
    font-size: .83rem;
    font-weight: 800;
    cursor: pointer;
}

.suggestion span {
    color: var(--pond);
}

.suggestion:hover {
    border-color: #b9c9b9;
    background: #e6eee4;
}

.preview-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 20px;
    background: #f0f0e7;
    color: var(--muted);
    font-size: .72rem;
}

/* ===== Quiz ===== */

.quiz-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(230px, .65fr);
    gap: 22px;
}

.quiz-card {
    min-height: 430px;
    padding: clamp(22px, 4vw, 42px);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 12px;
}

.quiz-illustration {
    margin-bottom: 15px;
    color: #c18b25;
    font-size: 2rem;
}

.quiz-card h3 {
    max-width: 500px;
    margin-bottom: 14px;
    font-size: clamp(1.5rem, 3vw, 2rem);
}

.quiz-card #quiz-start > p:not(.eyebrow),
.quiz-card #quiz-result > p:not(.eyebrow) {
    max-width: 520px;
    color: var(--muted);
}

.name-field {
    display: block;
    margin: 25px 0 7px;
    font-size: .8rem;
    font-weight: 900;
}

#quiz-name {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    border: 1px solid #cfd4c8;
    border-radius: 7px;
    background: #fffefa;
    color: var(--ink);
}

.field-error {
    margin: 7px 0 0;
    color: var(--danger);
    font-size: .8rem;
}

.quiz-progress-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    font-size: .73rem;
    font-weight: 900;
}

#quiz-progress-label {
    color: var(--pond);
    letter-spacing: .08em;
}

#quiz-score-label {
    color: var(--muted);
}

.progress-track {
    height: 6px;
    overflow: hidden;
    margin-bottom: 32px;
    background: #e5e8dc;
    border-radius: 999px;
}

#quiz-progress-fill {
    width: 0;
    height: 100%;
    background: var(--pond);
    transition: width .2s ease;
}

.quiz-options {
    display: grid;
    gap: 10px;
    margin-top: 23px;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 49px;
    padding: 11px 14px;
    background: #faf9f2;
    border: 1px solid #dfe2d7;
    border-radius: 7px;
    text-align: left;
    cursor: pointer;
    font-size: .9rem;
    font-weight: 800;
}

.option-letter {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: 1px solid #d7dcd0;
    border-radius: 50%;
    color: var(--muted);
    font-size: .75rem;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--pond);
    background: #f0f5ed;
}

.quiz-option.correct {
    border-color: #79a68a;
    background: #e5f1e6;
}

.quiz-option.correct .option-letter {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.quiz-option.incorrect {
    border-color: #d79a8f;
    background: #f8e9e5;
}

.quiz-option.incorrect .option-letter {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-feedback {
    min-height: 24px;
    margin: 14px 0 0;
    font-size: .85rem;
    font-weight: 800;
}

.quiz-feedback.is-correct {
    color: var(--success);
}

.quiz-feedback.is-wrong {
    color: var(--danger);
}

.result-score {
    margin: 25px 0 12px;
    color: var(--pond);
    font-size: clamp(4rem, 9vw, 6rem);
    font-weight: 900;
    letter-spacing: -.07em;
    line-height: 1;
}

.submit-status {
    font-size: .83rem;
    font-weight: 800;
}

.quiz-aside {
    align-self: stretch;
    padding: 29px;
    background: #e7eee3;
    border-radius: 12px;
}

.aside-number {
    color: var(--pond);
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: -.08em;
    line-height: 1;
}

.aside-number span {
    margin-left: 5px;
    color: #c08c27;
    font-size: 2rem;
    vertical-align: top;
}

.quiz-aside h3 {
    margin: 18px 0 10px;
    font-size: 1.35rem;
}

.quiz-aside > p:not(.aside-small) {
    color: var(--muted);
    font-size: .9rem;
}

.aside-rule {
    height: 1px;
    margin: 26px 0;
    background: #cbd7c7;
}

.aside-small {
    margin-bottom: 10px;
    color: var(--pond);
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .13em;
}

.quiz-aside ul {
    margin: 0;
    padding-left: 18px;
    color: #526357;
    font-size: .84rem;
}

.quiz-aside li {
    margin: 7px 0;
}

/* ===== Leaderboard ===== */

.leaderboard-section {
    padding: 78px 0 95px;
    background: #eeeee4;
}

.leaderboard-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 25px;
    margin-bottom: 30px;
}

.leaderboard-heading h2 {
    margin-bottom: 12px;
}

.leaderboard-intro {
    margin-bottom: 0;
    color: var(--muted);
}

.leaderboard-stamp {
    display: grid;
    place-content: center;
    flex-shrink: 0;
    width: 100px;
    height: 100px;
    border: 1px solid #c4cdbd;
    border-radius: 50%;
    color: var(--pond);
    text-align: center;
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .12em;
    line-height: 1.4;
    transform: rotate(9deg);
}

.leaderboard-wrap {
    width: min(1120px, calc(100% - 64px));
    margin: auto;
    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
}

.leaderboard-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.leaderboard-topline > span {
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .12em;
}

.text-button {
    padding: 5px 0;
    border: 0;
    background: none;
    color: var(--pond);
    font-size: .82rem;
    font-weight: 900;
    cursor: pointer;
}

.text-button:hover {
    text-decoration: underline;
}

.leaderboard-scroll {
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.leaderboard-table th {
    padding: 13px 22px;
    background: #f2f2e9;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.leaderboard-table td {
    padding: 16px 22px;
    border-top: 1px solid #ebebe2;
    font-size: .88rem;
}

.leaderboard-table td:first-child {
    color: var(--pond);
    font-weight: 900;
}

.leaderboard-table td:nth-child(2) {
    font-weight: 900;
}

.leaderboard-table td:nth-child(3) {
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.table-message {
    padding: 30px !important;
    text-align: center;
    color: var(--muted);
}

.leaderboard-note {
    margin: 0;
    padding: 13px 22px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .76rem;
}

/* ===== Footer ===== */

.site-footer {
    width: min(1200px, calc(100% - 64px));
    min-height: 100px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.footer-brand {
    font-size: 1rem;
}

.footer-brand .brand-mark {
    width: 30px;
    height: 30px;
}

.site-footer > p {
    margin: 0;
    color: var(--muted);
    font-size: .8rem;
}

.back-top {
    color: var(--pond);
    text-decoration: none;
    font-size: .8rem;
    font-weight: 900;
}

.back-top:hover {
    text-decoration: underline;
}

/* ===== Floating chatbot launcher ===== */

/* The user's logo is the launcher.
   No circle, border, background, or shadow is added by CSS. */
#chatbot-icon {
    position: fixed;
    right: 23px;
    bottom: 23px;
    z-index: 30;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 68px;
    height: 68px;
    padding: 0;

    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;

    cursor: pointer;
    transition: transform .16s ease;
}

#chatbot-icon:hover {
    transform: translateY(-3px);
}

#chatbot-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;

    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
}

/* Keep keyboard access clear without adding a permanent outline. */
#chatbot-icon:focus-visible {
    outline: 3px solid #bc7d17;
    outline-offset: 5px;
}

/* ===== Chat window ===== */

#chatbot-container {
    position: fixed;
    right: 23px;
    bottom: 100px;
    z-index: 40;

    display: flex;
    flex-direction: column;

    width: min(380px, calc(100vw - 32px));
    height: min(540px, calc(100dvh - 125px));
    min-height: 300px;

    overflow: hidden;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(24, 51, 36, .2);
}

#chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 14px 16px;
    background: var(--pond);
    color: white;
}

.chat-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-title small {
    color: #e0e9df;
}

#close-btn {
    display: grid;
    place-items: center;
    flex-shrink: 0;
    width: 35px;
    height: 35px;
    border: 0;
    background: transparent;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
}

#close-btn:hover {
    background: rgba(255, 255, 255, .12);
    border-radius: 50%;
}

#chatbot-body {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #f7f6ef;
}

#chatbot-messages {
    display: flex;
    flex-direction: column;
    gap: 11px;
}

.message {
    max-width: 88%;
    padding: 11px 13px;
    border-radius: 12px;
    font-size: .87rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.message.user {
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    background: var(--pond);
    color: white;
}

.message.bot {
    align-self: flex-start;
    border: 1px solid var(--line);
    border-bottom-left-radius: 3px;
    background: white;
    color: var(--ink);
}

.message.system {
    align-self: center;
    max-width: 100%;
    padding: 5px 10px;
    color: var(--muted);
    font-size: .76rem;
    text-align: center;
}

#chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    padding: 11px;
    background: white;
    border-top: 1px solid var(--line);
}

#chatbot-input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid #d6dbd0;
    border-radius: 7px;
    background: #fffefa;
    color: var(--ink);
}

#send-btn {
    padding: 10px 15px;
    border: 0;
    border-radius: 7px;
    background: var(--pond);
    color: white;
    font-weight: 900;
    cursor: pointer;
}

#send-btn:hover {
    background: var(--pond-dark);
}

#send-btn:disabled {
    opacity: .55;
    cursor: wait;
}

.chat-typing {
    color: var(--muted);
    font-size: .8rem;
    font-style: italic;
}

/* ===== Tablet layout ===== */

@media (max-width: 980px) {
    .main-nav {
        gap: 13px;
    }

    .main-nav a {
        font-size: .8rem;
    }

    .hero {
        gap: 22px;
        min-height: 500px;
    }

    .species-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .ask-section {
        gap: 35px;
    }
}

/* ===== Mobile and small tablet ===== */

@media (max-width: 760px) {
    .site-header {
        width: calc(100% - 36px);
        min-height: 70px;
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        justify-content: space-between;
        gap: 8px;
    }

    .main-nav a {
        font-size: .76rem;
    }

    .nav-chat-btn {
        padding: 8px 12px;
        font-size: .78rem;
    }

    .hero {
        width: calc(100% - 40px);
        grid-template-columns: 1fr;
        padding: 57px 0 50px;
        gap: 35px;
    }

    .hero-copy {
        max-width: 620px;
    }

    .hero-art {
        width: min(500px, 100%);
        margin: auto;
    }

    .hero-image-frame,
    .hero-image-frame img {
        min-height: 300px;
    }

    .intro-strip {
        justify-content: flex-start;
        gap: 10px;
        padding: 18px 20px;
    }

    .intro-strip > div {
        padding: 5px 10px;
        font-size: .77rem;
    }

    .section {
        width: calc(100% - 40px);
    }

    .section-heading {
        display: block;
    }

    .section-description {
        max-width: 550px;
        margin-top: 18px;
    }

    .species-section,
    .quiz-section {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .species-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }

    .species-image {
        height: 155px;
    }

    .ask-section {
        padding: 65px 20px;
        grid-template-columns: 1fr;
        gap: 35px;
    }

    .chat-preview {
        width: min(500px, 100%);
    }

    .quiz-layout {
        grid-template-columns: 1fr;
    }

    .quiz-aside {
        display: grid;
        grid-template-columns: auto 1fr;
        column-gap: 20px;
        align-items: center;
    }

    .aside-number {
        grid-row: span 2;
        font-size: 4rem;
    }

    .quiz-aside h3 {
        margin-top: 0;
    }

    .aside-rule,
    .aside-small,
    .quiz-aside ul {
        display: none;
    }

    .leaderboard-section {
        padding: 65px 0;
    }

    .leaderboard-heading,
    .leaderboard-wrap {
        width: calc(100% - 40px);
    }

    .site-footer {
        width: calc(100% - 40px);
        flex-wrap: wrap;
        padding: 25px 0;
    }
}

/* ===== Small mobile ===== */

@media (max-width: 480px) {
    h1 {
        font-size: clamp(2.8rem, 14vw, 4.2rem);
    }

    .hero-description {
        font-size: .96rem;
    }

    .hero-image-frame,
    .hero-image-frame img {
        min-height: 260px;
    }

    .floating-note {
        font-size: .67rem;
        padding: 8px 10px;
    }

    .note-top {
        right: -5px;
    }

    .intro-strip {
        display: grid;
        grid-template-columns: 1fr;
    }

    .intro-strip > div {
        padding: 3px 0;
    }

    .intro-strip > div + div {
        border-left: 0;
    }

    .species-grid {
        grid-template-columns: 1fr;
    }

    .species-image {
        height: 205px;
    }

    .explorer-controls {
        align-items: stretch;
    }

    .search-box {
        flex-basis: 100%;
    }

    .filter-label {
        align-self: center;
    }

    #species-filter {
        flex: 1;
        min-width: 0;
    }

    .preview-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .quiz-card {
        padding: 23px 18px;
    }

    .quiz-aside {
        padding: 22px;
    }

    .leaderboard-heading {
        align-items: flex-start;
    }

    .leaderboard-stamp {
        width: 75px;
        height: 75px;
        font-size: .6rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 13px 12px;
        font-size: .78rem;
    }

    .leaderboard-table th {
        font-size: .63rem;
    }

    .site-footer {
        justify-content: center;
        text-align: center;
    }

    .site-footer > p {
        flex-basis: 100%;
        order: 3;
    }

    #chatbot-icon {
        right: 15px;
        bottom: 15px;
        width: 56px;
        height: 56px;
    }

    #chatbot-container {
        right: 10px;
        bottom: 80px;
        width: calc(100vw - 20px);
        height: min(540px, calc(100dvh - 100px));
    }
}

/* ===== Respect reduced-motion preferences ===== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}
