
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: linear-gradient(180deg, #494D5F 0%, #817dc2 100%);
    color: #ffffff;
    margin: 0;
    padding: 0;
}

header {
    background: -moz-repeating-linear-gradient(90deg, #124896 0%, #9460a0 100%);
    color: rgb(241, 64, 0);
    padding: 1.5rem 2rem;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.1),
        0 4px 10px rgba(0,0,0,0.3);
}

.header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.header-bar h1 {
    margin: 0;
}

.search-wrap {
    position: relative;
}

#searchInput {
    width: 300px;
    max-width: 80%;
    padding: 0.6rem;
    font-size: 1rem;
    border-radius: 6px;
    border: none;
    text-align: right;
}

#results {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0;
    position: absolute;
    width: 100%;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    z-index: 20;
}

#results li {
    padding: 0.5rem;
    color: #2e2a25;
    cursor: pointer;
    text-align: left;
}

#results li:hover {
    background-color: #e0ddd2;
}

main img {
    width: 100%;
    max-width: 500px;
    height: 300px;
    object-fit: cover;
    border-radius: 8px;
    margin: 1rem 0;
}

.preview-card {
    background: linear-gradient(100deg, #b18a2e 0%, #929290 100%);
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 1.5rem;
    max-width: 750px;
    max-height: 500px;
    margin: 0 auto;
    cursor: pointer;
    transition: transform 0.5s ease;
}

.preview-card:hover {
    transform: translateY(-4px);
}

.preview-card img {
    width: 100%;
    height: 480px;
    object-fit: cover;
    border-radius: 6px;
}

.preview-card h3 {
    margin: 0.75rem 0 0.25rem;
}

.tap-hint {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #777;
}

.fade {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.wheel-container {
    overflow: hidden;
    padding: 2rem 0;
}

#siteTitle {
    cursor: pointer;
}

/* ---- Category sections ---- */
#categories {
    max-width: 1300px;
    margin: 0 auto;
    padding: 1rem 2rem 3rem;
}

.cat-section {
    margin-bottom: 2.5rem;
    border-radius: 12px;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.5),
        0 4px 15px rgba(0, 0, 0, 0.3);
}

.cat-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0) 70%
    );
    border-radius: 12px 12px 0 0;
    pointer-events: none;
    z-index: 1;
}

.cat-section .cat-header,
.cat-section .cat-row {
    position: relative;
    z-index: 2;
}

.cat-section[data-category="carnivore"] {
    background: linear-gradient(135deg, #b90c0c 0%, #579dff 100%);
}

.cat-section[data-category="herbivore"] {
    background: linear-gradient(135deg, #1a3d1a 0%, #579dff 100%);
}

.cat-section[data-category="omnivore"] {
    background: linear-gradient(135deg, #3d1a1a 0%, #579dff 100%);
}

.cat-section[data-category="piscivore"] {
    background: linear-gradient(135deg, #075d96 0%, #579dff 100%);
}

.cat-section[data-category="insectivore"] {
    background: linear-gradient(135deg, #bd7018 0%, #579dff 100%);
}

.cat-section[data-category="triassic"] {
    background: linear-gradient(135deg, #878787 0%, #579dff 100%);
}

.cat-section[data-category="jurassic"] {
    background: linear-gradient(135deg, #16a116 0%, #579dff 100%);
}

.cat-section[data-category="cretaceous"] {
    background: linear-gradient(135deg, #2d3a1a 0%, #579dff 100%);
}

.cat-section[data-category] .cat-header h2 {
    color: #f0ece0;
}

.cat-section[data-category] .view-all {
    color: #ffffff;
}

.cat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cat-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: #2e2a25;
}

.view-all {
    font-size: 0.9rem;
    color: #3e5641;
    cursor: pointer;
    font-weight: bold;
}

.view-all:hover {
    text-decoration: underline;
}

.cat-row {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.cat-row::-webkit-scrollbar {
    height: 4px;
}

.cat-row::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 4px;
}

.cat-card {
    min-width: 220px;
    max-width: 220px;
    height: 180px;
    border-radius: 10px;
    overflow: hidden;
    -webkit-clip-path: inset(0 0 0 0 round 10px);
    clip-path: inset(0 0 0 0 round 10px);
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.3),
        0 2px 0 rgba(0,0,0,0.2),
        0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s ease;
}

.cat-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cat-card:hover {
    transform: translateY(-4px);
}

.cat-card h4 {
    margin: 0 0 0.3rem;
    font-size: 0.95rem;
}

.cat-card span {
    font-size: 0.8rem;
    color: #888;
}

/* ---- All category grid view ---- */
.all-cat-title {
    text-align: center;
    margin-bottom: 1.5rem;
}

.all-cat-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    padding: 0 1rem 2rem;
}

/* ---- Back button ---- */
.back-btn {
    display: block;
    margin: 1rem 1rem 1rem auto;
    background: rgba(124, 150, 255, 0.75);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s ease;
}

.back-btn:hover {
    background: rgb(255, 47, 0);
}

/* ---- Main / Wheel ---- */
main {
    height: 520px;
    position: relative;
    overflow: visible;
    text-align: center;
    background: transparent;
    padding-top: 1.5rem;
}

.wheel-track {
    position: relative;
    height: 480px;
    margin-top: 0;
}

.wheel-card {
    position: absolute;
    top: 0;
    left: 50%;
    width: 340px;
    height: 480px;
    margin-left: -170px;
    border-radius: 10px;
    overflow: hidden;
    -webkit-clip-path: inset(0 0 0 0 round 10px);
    clip-path: inset(0 0 0 0 round 10px);
    cursor: pointer;
    transition: transform 0.6s ease, opacity 0.6s ease;
    box-sizing: border-box;
    border: none;
    padding: 0;
    box-shadow:
        0 1px 0 #fff,
        0 2px 0 #ddd,
        0 4px 6px rgba(0,0,0,0.2);
}

.wheel-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    margin: 0;
    padding: 0;
}

.wheel-card h3 {
    margin: 0.75rem 0 0.25rem;
    font-size: 1.1rem;
}

.wheel-card p {
    font-size: 0.85rem;
    color: #555;
    margin: 0.4rem 0 0;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    line-clamp: 3;
}

.featured-title {
    text-align: center;
    margin: 2rem 0 0.5rem;
    font-size: 1.6rem;
    color: #80a8ff;
}

/* ---- Dino detail ---- */
main.dino-detail {
    background: rgba(255, 255, 255, 0.30);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    max-width: 1400px;
    margin: 2rem auto;
    padding: 2rem;
    text-align: left;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* ---- Card overlay ---- */
.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(33, 44, 57, 0.785);
    color: white;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transform: translateY(100%);
    transition: transform 0.4s ease;
}

.wheel-card:hover .card-overlay,
.cat-card:hover .card-overlay {
    transform: translateY(0);
}

.card-overlay h3 {
    margin: 0;
    font-size: 1.1rem;
    color: white;
}

.card-overlay p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
}

/* ---- List view ---- */
.list-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 0 2rem;
}

.list-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.list-card:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(4px);
}

.list-card img {
    width: 180px;
    min-width: 180px;
    height: 100px;
    object-fit: cover;
    display: block;
}

.list-card-info {
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.list-card-info h3 {
    margin: 0;
    font-size: 1.05rem;
    color: #f0ece0;
}

.list-card-period {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.list-card-info p {
    margin: 0;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

/* ---- Header right group ---- */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#filterBtn {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    white-space: nowrap;
    transition: background 0.2s ease;
}

#filterBtn:hover {
    background: rgba(255,255,255,0.25);
}

/* ---- Filter page ---- */
.filter-page {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1rem 2rem;
    text-align: left;
}

.filter-page h3 {
    text-align: left;
}

.filter-page .filter-options {
    justify-content: flex-start;
}

.filter-group h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(238, 61, 61, 0.08);
    color: rgba(255,255,255,0.8);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    user-select: none;
}

.filter-chip input {
    display: none;
}

.filter-chip.active {
    background: rgb(255, 96, 96);
    border-color: rgba(255,255,255,0.6);
    color: white;
    font-weight: bold;
}

.filter-chip:hover {
    background: rgba(255,255,255,0.15);
}

.filter-results {
    margin-top: 1rem;
    width: 100%;
    padding: 0 2rem;
    box-sizing: border-box;
    text-align: left;
}

#filterResults {
    width: 100%;
    padding: 0 2rem;
    box-sizing: border-box;
    text-align: left;
}

.results-count {
    color: rgba(255,255,255,0.5);
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-align: left;
}

.no-results {
    color: rgba(255,255,255,0.5);
    text-align: left;
    padding: 2rem 0;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {

    header {
        background: -webkit-repeating-linear-gradient(90deg, rgba(124, 150, 255, 0.75) 0%, #9460a0 100%) !important;
        background: repeating-linear-gradient(90deg, rgba(124, 150, 255, 0.75) 0%, #9460a0 100%) !important;
    }

    .header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .header-right {
        width: 100%;
        flex-direction: row-reverse;
        justify-content: flex-end;
    }

    #searchInput {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .search-wrap {
        width: 100%;
    }

    #results {
        width: 100%;
    }

    #filterBtn {
        font-size: 0.8rem;
        padding: 0.4rem 0.75rem;
    }

    .featured-title {
        font-size: 1.2rem;
        margin: 1rem 0 0.25rem;
    }

    main {
        height: 420px;
        overflow: hidden;
    }

    .wheel-track {
        height: 380px;
    }

    .wheel-card {
        width: 180px;
        height: 340px;
        margin-left: -90px;
    }

    #categories {
        padding: 1rem;
    }

    .cat-section {
        padding: 1rem;
    }

    .cat-card {
        min-width: 160px;
        max-width: 160px;
        height: 140px;
    }

    .cat-card img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }

    .cat-card h4 {
        font-size: 0.8rem;
    }

    .cat-card span {
        font-size: 0.7rem;
    }

    main.dino-detail {
        margin: 1rem;
        padding: 1.25rem;
    }

    main img {
        height: 200px;
    }

    .list-card img {
        width: 110px;
        min-width: 110px;
        height: 80px;
    }

    .list-card-info h3 {
        font-size: 0.95rem;
    }

    .list-card-info p {
        display: none;
    }

    .all-cat-grid {
        gap: 0.75rem;
        padding: 0 0.5rem 1.5rem;
    }

    .back-btn {
        margin: 0.5rem 1rem 1rem auto;
    }

    .filter-page {
        padding: 1rem;
    }

    #filterResults {
        padding: 0 1rem;
    }
    .card-overlay {
      transform: none !important;
      opacity: 0;
      transition: opacity 0.4s ease;
    }

    .wheel-card:hover .card-overlay,
    .cat-card:hover .card-overlay {
      transform: none !important;
      opacity: 1;
    }
}

