:root {
    color-scheme: light;
    --blue: #2864e8;
    --blue-dark: #164fc6;
    --ink: #1b2940;
    --muted: #6b7890;
    --line: #e5eaf2;
    --background: #f6f8fc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--background);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-text-size-adjust: 100%;
}

button, input, select {
    font: inherit;
}

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

button, a {
    touch-action: manipulation;
}

button {
    cursor: pointer;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
    outline: 3px solid #99b8ff;
    outline-offset: 3px;
}

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

button:disabled {
    cursor: wait;
    opacity: 0.65;
}

.header {
    position: sticky;
    top: 0;
    z-index: 30;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.header-inner {
    max-width: 1240px;
    min-height: 84px;
    padding: 14px 32px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 20px;
    font-weight: 750;
    white-space: nowrap;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.8px;
    font-weight: 400;
}

.brand-icon {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    width: 40px;
    height: 40px;
    padding: 9px;
    border-radius: 12px;
    background: var(--blue);
}

.brand-icon i {
    background: #fff;
    border-radius: 2px;
}

.brand-icon i:last-child {
    opacity: 0.5;
}

.nav {
    display: flex;
    gap: 8px;
}

.nav-item {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    min-width: 74px;
    padding: 8px 20px;
    color: var(--muted);
    border-radius: 10px;
    font-weight: 600;
}

.nav-item.active {
    color: var(--blue);
    background: #edf3ff;
}

.main-content {
    max-width: 1240px;
    margin: 0 auto;
    padding: 36px 32px 24px;
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.eyebrow {
    display: block;
    color: var(--blue);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 270px;
    gap: 36px;
    padding: 48px 40px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: 0 8px 30px #27456b05;
}

.hero h1 {
    font-size: 36px;
    font-weight: 750;
    letter-spacing: -1px;
    line-height: 1.4;
}

.hero p {
    color: var(--muted);
    margin-top: 12px;
}

.home-search {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 28px;
    padding: 6px;
    border: 1px solid #d6e1f2;
    border-radius: 12px;
    background: #f9fbff;
}

.search-icon {
    width: 22px;
    height: 22px;
    margin-left: 10px;
    fill: none;
    stroke: #8190a8;
    stroke-width: 1.8;
    flex-shrink: 0;
}

.home-search input {
    min-width: 0;
    flex: 1;
    width: 0;
    border: 0;
    background: transparent;
    padding: 10px 0;
    font-size: 16px;
    color: var(--ink);
}

.home-search input:focus {
    outline: none;
}

.home-search:focus-within {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px #2864e812;
}

input::placeholder {
    color: #8894a6;
}

.btn-primary {
    min-height: 46px;
    padding: 10px 22px;
    color: #fff;
    background: var(--blue);
    border: 0;
    border-radius: 9px;
    font-weight: 650;
    white-space: nowrap;
}

.search-hint {
    color: #8190a5;
    font-size: 12px;
    margin-top: 10px;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-content: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    border-radius: 16px;
    background: #f4f7fd;
    min-width: 0;
}

.stat-label {
    color: var(--muted);
    font-size: 12px;
}

.stat-item strong {
    font-size: 28px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.8px;
    margin: 8px 0 4px;
}

.stat-unit {
    color: #8b97aa;
    font-size: 11px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 32px 0 16px;
    gap: 12px;
}

.section-heading h2 {
    font-size: 18px;
}

.section-heading > span {
    color: var(--muted);
    font-size: 12px;
}

.entry-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.entry-card {
    text-align: left;
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 26px;
    background: #fff;
}

.entry-card strong {
    display: block;
    font-size: 17px;
    font-weight: 650;
}

.entry-card small {
    display: block;
    color: var(--muted);
    margin-top: 6px;
    font-size: 12px;
}

.entry-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    background: #eaf1ff;
    color: var(--blue);
    font-size: 30px;
    border-radius: 14px;
}

.entry-icon.categories {
    color: #407a99;
    background: #eaf5fa;
}

.entry-arrow {
    margin-left: auto;
    color: #9ba8bc;
    font-size: 24px;
}

.home-note {
    display: flex;
    gap: 8px;
    color: var(--muted);
    margin-top: 22px;
    font-size: 12px;
}

.home-note > span {
    color: var(--blue);
}

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

.page-heading h1 {
    font-size: 28px;
    line-height: 1.3;
}

.page-heading .eyebrow {
    margin-bottom: 6px;
}

.page-heading p {
    color: var(--muted);
    font-size: 13px;
}

.search-card {
    padding: 22px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
}

.search-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.tab {
    min-height: 42px;
    padding: 8px 22px;
    background: #f5f7fb;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--muted);
}

.tab.active {
    background: #edf3ff;
    border-color: #cfddfc;
    color: var(--blue);
    font-weight: 650;
}

.search-box {
    display: flex;
    gap: 12px;
}

.search-input, .type-select {
    min-width: 0;
    flex: 1;
    width: 0;
    min-height: 48px;
    border: 1px solid #dbe3ee;
    border-radius: 10px;
    background: #fff;
    padding: 10px 14px;
    color: var(--ink);
    font-size: 16px;
}

.results {
    margin-top: 24px;
}

.result-count {
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    margin-bottom: 16px;
    font-size: 13px;
}

.result-count strong {
    color: var(--ink);
}

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

.item-card {
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: #fff;
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.item-open {
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
    flex: 1;
    background: transparent;
    border: 0;
    text-align: left;
}

.item-card-img-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 160px;
    padding: 20px;
    background: #eff3f9;
}

.item-card-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.item-card-body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding: 16px 16px 12px;
    gap: 8px;
}

.item-tag {
    display: inline-block;
    max-width: 100%;
    padding: 2px 7px;
    border-radius: 5px;
    background: #edf3ff;
    color: #496fae;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.item-name {
    font-size: 15px;
    font-weight: 650;
    line-height: 1.5;
    min-height: 45px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.item-id {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.item-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #7d899b;
    font-size: 12px;
    line-height: 1.6;
    height: 38.4px;
    overflow-wrap: anywhere;
}

.item-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid #edf0f5;
    padding: 6px;
    gap: 4px;
}

.copy-btn {
    min-height: 36px;
    padding: 5px 8px;
    border: 0;
    border-radius: 6px;
    color: #5476b3;
    background: transparent;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.types-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 16px;
}

.type-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    gap: 12px;
    min-width: 0;
    min-height: 112px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.type-name {
    font-weight: 650;
    font-size: 15px;
    overflow-wrap: anywhere;
}

.type-count {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 12px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.type-count span {
    color: #9babbe;
    font-size: 18px;
}

.empty-state, .loading, .no-results, .error {
    grid-column: 1 / -1;
    padding: 64px 20px;
    text-align: center;
    color: var(--muted);
}

.empty-state h2 {
    margin-top: 12px;
    font-size: 18px;
    color: #53647e;
}

.empty-state p {
    margin-top: 8px;
    font-size: 13px;
}

.empty-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: #eaf0fa;
    border-radius: 18px;
    font-size: 36px;
    color: #7899c6;
}

.footer {
    margin-top: 40px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    text-align: center;
    font-size: 11px;
    color: #97a1b2;
}

.footer span {
    margin: 0 8px;
}

body.modal-open {
    overflow: hidden;
}

.modal {
    display: none;
    position: fixed;
    z-index: 60;
    inset: 0;
    height: 100%;
    height: 100dvh;
    background: #14213766;
    padding: 32px 20px;
}

.modal-content {
    width: 100%;
    max-width: 640px;
    max-height: 100%;
    margin: 0 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-radius: 22px;
    box-shadow: 0 24px 80px #10213d33;
}

.modal-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    padding: 12px 20px;
    background: #fff;
    z-index: 1;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
}

.close {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    background: #f1f4f9;
    color: #697991;
    font-size: 28px;
    border-radius: 10px;
}

#modal-body {
    padding: 24px;
}

.detail-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding-bottom: 22px;
}

.detail-image {
    width: 112px;
    height: 112px;
    padding: 14px;
    object-fit: contain;
    border-radius: 16px;
    background: #eff3f9;
    flex-shrink: 0;
}

.detail-hero h2 {
    margin: 10px 0 0;
    font-size: 22px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.detail-title-group {
    min-width: 0;
}

.detail-row {
    padding: 14px 0;
    border-top: 1px solid var(--line);
}

.detail-row-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.detail-label {
    color: var(--muted);
    font-size: 12px;
}

.detail-value {
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}

.detail-row .copy-btn {
    min-height: 36px;
    background: #f2f6fd;
    padding: 6px 12px;
}

.toast {
    position: fixed;
    z-index: 100;
    left: 50%;
    bottom: max(28px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    border-radius: 10px;
    background: #1b2b46;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 8px 30px #10213d22;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    text-align: center;
}

.toast.visible {
    opacity: 1;
}

@media (hover: hover) {
    .nav-item:hover {
        background: #f1f5fc;
        color: var(--blue);
    }
    .btn-primary:hover {
        background: var(--blue-dark);
    }
    .entry-card:hover, .item-card:hover, .type-card:hover {
        border-color: #b4caf4;
        box-shadow: 0 5px 18px #2864e80a;
    }
    .copy-btn:hover {
        background: #edf3ff;
        color: var(--blue);
    }
}

@media (max-width: 1050px) {
    .hero {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        padding: 32px;
    }
    .stats {
        max-width: 400px;
    }
    .stat-item {
        padding: 16px;
    }
    .items-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 16px;
    }
    .types-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .header-inner {
        min-height: 0;
        padding: max(12px, env(safe-area-inset-top)) 16px 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .brand {
        font-size: 19px;
        gap: 10px;
    }
    .brand small {
        font-size: 10px;
    }
    .brand-icon {
        width: 36px;
        height: 36px;
        padding: 8px;
        border-radius: 10px;
    }
    .nav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        padding: 3px;
        background: #f5f7fb;
        border-radius: 10px;
    }
    .nav-item {
        min-height: 40px;
        min-width: 0;
        padding: 6px 0;
        font-size: 13px;
        border-radius: 7px;
    }
    .nav-item.active {
        background: #fff;
        box-shadow: 0 2px 5px #19325e08;
    }
    .main-content {
        padding: 22px max(14px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    }
    .hero {
        padding: 24px 18px 18px;
        gap: 22px;
        border-radius: 18px;
    }
    .hero h1 {
        font-size: 27px;
        letter-spacing: -0.5px;
    }
    .hero p {
        font-size: 13px;
        line-height: 1.8;
        margin-top: 10px;
    }
    .eyebrow {
        font-size: 11px;
        margin-bottom: 10px;
    }
    .home-search {
        margin-top: 22px;
        gap: 6px;
        padding: 5px;
    }
    .home-search .search-icon {
        display: none;
    }
    .home-search input {
        padding: 10px 6px;
    }
    .home-search .btn-primary {
        padding: 10px 12px;
        font-size: 13px;
    }
    .search-hint {
        font-size: 11px;
    }
    .stats {
        max-width: none;
        gap: 10px;
    }
    .stat-item {
        padding: 16px;
        border-radius: 12px;
    }
    .stat-item strong {
        font-size: 28px;
        margin: 4px 0 0;
    }
    .stat-unit {
        display: none;
    }
    .section-heading {
        margin: 26px 0 14px;
    }
    .section-heading h2 {
        font-size: 16px;
    }
    .section-heading > span {
        font-size: 11px;
    }
    .entry-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .entry-card {
        padding: 18px 16px;
        border-radius: 14px;
        gap: 14px;
    }
    .entry-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        font-size: 25px;
    }
    .entry-card strong {
        font-size: 15px;
    }
    .entry-card small {
        font-size: 11px;
        margin-top: 4px;
    }
    .home-note {
        margin-top: 18px;
        font-size: 11px;
    }
    .page-heading {
        display: block;
        margin-bottom: 20px;
    }
    .page-heading h1 {
        font-size: 24px;
    }
    .page-heading p {
        margin-top: 8px;
        font-size: 12px;
    }
    .search-card {
        padding: 14px;
        border-radius: 14px;
    }
    .search-tabs {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 4px;
        margin-bottom: 12px;
    }
    .tab {
        min-height: 44px;
        padding: 7px 2px;
        font-size: 12px;
        white-space: nowrap;
    }
    .search-box {
        gap: 8px;
    }
    .search-input, .type-select {
        padding: 10px;
    }
    .search-box .btn-primary {
        padding: 10px 18px;
    }
    .results {
        margin-top: 20px;
    }
    .result-count {
        margin-bottom: 12px;
        font-size: 12px;
    }
    .items-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .item-card {
        border-radius: 12px;
    }
    .item-card-img-wrapper {
        height: 130px;
        padding: 16px;
    }
    .item-card-body {
        padding: 12px 10px;
        gap: 6px;
    }
    .item-name {
        font-size: 13px;
        min-height: 39px;
    }
    .item-id {
        font-size: 11px;
    }
    .item-desc {
        display: none;
    }
    .item-tag {
        font-size: 10px;
    }
    .item-actions {
        padding: 4px;
        gap: 2px;
    }
    .item-actions .copy-btn {
        min-height: 40px;
        padding: 4px 1px;
        font-size: 11px;
    }
    .types-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }
    .type-card {
        min-height: 98px;
        padding: 16px 14px;
        border-radius: 12px;
        gap: 10px;
    }
    .type-name {
        font-size: 14px;
    }
    .empty-state, .loading, .no-results, .error {
        padding: 44px 14px;
    }
    .footer {
        margin-top: 30px;
    }
    .modal {
        padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    }
    .modal-content {
        border-radius: 18px;
    }
    .modal-top {
        padding: 8px 14px;
    }
    .close {
        width: 44px;
        height: 44px;
    }
    #modal-body {
        padding: 18px;
    }
    .detail-hero {
        gap: 14px;
        padding-bottom: 18px;
    }
    .detail-image {
        width: 90px;
        height: 90px;
        padding: 12px;
    }
    .detail-hero h2 {
        font-size: 18px;
    }
    .detail-row .copy-btn {
        min-height: 44px;
    }
}

@media (max-width: 350px) {
    .hero {
        padding: 20px 14px 14px;
    }
    .hero h1 {
        font-size: 24px;
    }
    .home-search {
        flex-wrap: wrap;
        padding: 6px;
    }
    .home-search input {
        flex-basis: 100%;
    }
    .home-search .btn-primary {
        width: 100%;
    }
    .item-card-img-wrapper {
        height: 112px;
    }
    .items-grid {
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}

