/* css/hunter/characters.css */

/* =========================
   Hunter Characters
========================= */

.hunter-character-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hunter-character-card {
    appearance: none;

    display: flex;
    flex-direction: column;
    align-items: center;

    width: 100%;
    padding: 16px 12px;
    border-radius: 18px;

    background: #ffffff;
    border: 1px solid #f3f4f6;

    text-align: center;
    font-family: inherit;
    cursor: pointer;

    transition:
        transform .16s ease,
        border-color .16s ease,
        box-shadow .16s ease,
        background .16s ease;
}

.hunter-character-card:hover {
    transform: translateY(-2px);
    border-color: #facc15;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .08);
}

.hunter-character-card.selected {
    border-color: #f59e0b;
    background:
        radial-gradient(circle at top, rgba(251, 191, 36, .22), transparent 42%),
        linear-gradient(180deg, #fff7df, #ffffff);

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .95),
        0 0 0 2px rgba(245, 158, 11, .28),
        0 4px 0 #d97706,
        0 12px 24px rgba(15, 23, 42, .12);
}

.hunter-character-image {
    width: 180px;
    height: 180px;

    margin-bottom: 10px;

    object-fit: contain;
    image-rendering: pixelated;
}

.hunter-character-name {
    margin-bottom: 4px;

    color: #111827;
    font-size: 15px;
    font-weight: 900;
}

.hunter-character-card.selected .hunter-character-name::after {
    content: "已選擇";
    display: inline-flex;

    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 999px;

    background: #fef3c7;
    color: #92400e;

    font-size: 11px;
    font-weight: 900;
}

.hunter-character-desc {
    max-width: 240px;

    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.5;
}


.hunter-character-card:focus {
    outline: none;
}

.hunter-character-card:focus-visible {
    outline: 3px solid rgba(59, 130, 246, .55);
    outline-offset: 3px;
}
/* =========================
   Hunter Roster v0.2.3
========================= */

.hunter-character-roster-details[open] summary::after {
    content: "收合";
}

.hunter-character-section {
    padding: 0 14px 14px;
}

.hunter-section-desc {
    margin: -4px 0 12px;
    color: #6b7280;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.5;
}

.hunter-character-row {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.hunter-character-card {
    position: relative;
    overflow: hidden;
}

.hunter-character-card.is-locked {
    cursor: not-allowed;
    background: linear-gradient(180deg, #f9fafb, #ffffff);
    border-style: dashed;
    opacity: .74;
}

.hunter-character-card.is-locked:hover {
    transform: none;
    border-color: #e5e7eb;
    box-shadow: none;
}

.hunter-character-card.is-locked .hunter-character-image {
    filter: grayscale(1);
    opacity: .58;
}

.hunter-character-card.is-locked::before {
    content: "🔒";
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .82);
    color: #ffffff;
    font-size: 14px;
}

.hunter-character-meta-row {
    min-height: 22px;
    margin-bottom: 4px;
}

.hunter-character-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 11px;
    font-weight: 900;
}

.hunter-character-card.selected .hunter-character-status {
    background: #111827;
    color: #ffffff;
}

.hunter-character-card.is-locked .hunter-character-status {
    background: #e5e7eb;
    color: #6b7280;
}

.hunter-character-title,
.hunter-character-type {
    color: #92400e;
    font-size: 11px;
    font-weight: 900;
    line-height: 1.35;
}

.hunter-character-type {
    margin-bottom: 5px;
    color: #374151;
}

/* =========================
   Hunter roster compact v0.2.3-a
========================= */

.hunter-character-roster-details:not([open]) {
    margin-bottom: 12px;
}

.hunter-character-row {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
}

.hunter-character-card {
    padding: 10px 8px;
    border-radius: 14px;
}

.hunter-character-image {
    width: 108px;
    height: 108px;
    margin-bottom: 6px;
}

.hunter-character-meta-row {
    min-height: 20px;
    margin-bottom: 3px;
}

.hunter-character-name {
    margin-bottom: 2px;
    font-size: 14px;
}

.hunter-character-title,
.hunter-character-type {
    font-size: 10px;
}

.hunter-character-desc {
    display: none;
}

/* =========================
   Hunter character modal beta
========================= */

.hunter-character-open-btn {
    position: relative;
    padding: 0;
    border: 2px solid #f3d58b;
    cursor: pointer;
    font-family: inherit;
}

.hunter-character-open-btn:hover {
    transform: translateY(-1px);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .95),
        0 3px 0 #d6a94f,
        0 10px 18px rgba(15, 23, 42, .12);
}

.hunter-character-open-btn:focus {
    outline: none;
}

.hunter-character-open-btn:focus-visible {
    outline: 3px solid rgba(245, 158, 11, .55);
    outline-offset: 3px;
}

.hunter-character-open-badge {
    position: absolute;
    right: -6px;
    bottom: -8px;
    z-index: 2;

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

    padding: 4px 8px;
    border-radius: 999px;

    background: #111827;
    color: #ffffff;
    border: 2px solid #ffffff;

    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(15, 23, 42, .18);
}

.hunter-character-open-btn.has-achievement-frame {
    --hunter-frame-primary: #f3d58b;
    --hunter-frame-secondary: #fff3c4;
    --hunter-frame-glow: #d6a94f;
    border-color: var(--hunter-frame-primary);
    background:
        radial-gradient(ellipse at 50% 72%, color-mix(in srgb, var(--hunter-frame-secondary) 34%, transparent), transparent 50%),
        linear-gradient(160deg, rgba(255, 255, 255, .92), color-mix(in srgb, var(--hunter-frame-primary) 20%, #fff));
    box-shadow:
        inset 0 0 0 2px color-mix(in srgb, var(--hunter-frame-secondary) 72%, transparent),
        0 0 16px color-mix(in srgb, var(--hunter-frame-glow) 58%, transparent),
        0 4px 0 color-mix(in srgb, var(--hunter-frame-primary) 72%, #422006);
}

.hunter-character-open-btn.has-achievement-frame::before {
    content: "";
    position: absolute;
    inset: -4px;
    z-index: 3;
    border: 3px solid transparent;
    border-radius: inherit;
    background:
        conic-gradient(
            from 0deg,
            var(--hunter-frame-primary),
            var(--hunter-frame-secondary),
            var(--hunter-frame-primary),
            var(--hunter-frame-glow),
            var(--hunter-frame-primary)
        ) border-box;
    -webkit-mask:
        linear-gradient(#fff 0 0) padding-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.hunter-character-open-btn.has-achievement-frame .hunter-player-avatar {
    position: relative;
    z-index: 1;
}

.hunter-character-open-btn.has-achievement-frame .hunter-character-open-badge {
    z-index: 5;
}

.hunter-character-modal[hidden] {
    display: none !important;
}

.hunter-character-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;

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

    padding: 18px;
}

.hunter-character-modal-backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, .58);
    cursor: pointer;
}

.hunter-character-modal-panel {
    position: relative;
    z-index: 1;

    box-sizing: border-box;
    width: min(620px, 100%);
    max-height: min(760px, calc(100dvh - 36px));
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;

    padding: 20px 20px max(20px, env(safe-area-inset-bottom));
    border-radius: 24px;

    background:
        radial-gradient(circle at top left, rgba(251, 191, 36, .24), transparent 38%),
        linear-gradient(180deg, #fffdf5, #ffffff);
    border: 2px solid #f3d58b;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, .96),
        0 18px 44px rgba(15, 23, 42, .28);
}

.hunter-character-modal-close {
    position: sticky;
    top: 0;
    z-index: 5;

    display: grid;
    width: 34px;
    height: 34px;
    margin: 0 0 -34px auto;
    place-items: center;
    border-radius: 999px;
    border: 1px solid #f3d58b;

    background: #ffffff;
    color: #92400e;

    font-size: 22px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
}

.hunter-character-modal-close:hover {
    background: #fffbeb;
}

.hunter-character-modal-kicker {
    margin-bottom: 4px;
    color: #92400e;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
}

.hunter-character-modal-title {
    margin: 0 42px 6px 0;
    color: #111827;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.25;
}

.hunter-character-modal-desc {
    margin: 0 0 14px;
    color: #6b7280;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.6;
}

.hunter-character-modal-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hunter-avatar-frame-section {
    margin-top: 18px;
    border-top: 1px solid rgba(217, 119, 6, .2);
    padding-top: 16px;
}

.hunter-avatar-frame-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.hunter-avatar-frame-heading span {
    display: block;
    color: #92400e;
    font-size: 9px;
    font-weight: 950;
    letter-spacing: .13em;
}

.hunter-avatar-frame-heading h3 {
    margin: 2px 0 0;
    color: #111827;
    font-size: 17px;
}

.hunter-avatar-frame-heading small {
    color: #78716c;
    font-size: 10px;
    font-weight: 800;
    text-align: right;
}

.hunter-avatar-frame-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.hunter-avatar-frame-option {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-height: 58px;
    border: 1px solid #e7d7b4;
    border-radius: 13px;
    padding: 8px;
    color: #292524;
    background: rgba(255, 255, 255, .78);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.hunter-avatar-frame-option:hover:not(:disabled) {
    border-color: var(--hunter-frame-primary, #d97706);
    transform: translateY(-1px);
}

.hunter-avatar-frame-option.is-selected {
    border-color: var(--hunter-frame-primary, #d97706);
    background: color-mix(in srgb, var(--hunter-frame-secondary, #fef3c7) 28%, #fff);
    box-shadow:
        inset 0 0 0 1px var(--hunter-frame-primary, #d97706),
        0 5px 14px color-mix(in srgb, var(--hunter-frame-glow, #d97706) 22%, transparent);
}

.hunter-avatar-frame-option.is-locked {
    cursor: not-allowed;
    filter: grayscale(.7);
    opacity: .58;
}

.hunter-avatar-frame-swatch {
    position: relative;
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 3px solid transparent;
    border-radius: 12px;
    background:
        linear-gradient(#1f2937, #111827) padding-box,
        conic-gradient(
            var(--hunter-frame-primary, #f3d58b),
            var(--hunter-frame-secondary, #fff3c4),
            var(--hunter-frame-glow, #d6a94f),
            var(--hunter-frame-primary, #f3d58b)
        ) border-box;
    color: #fff;
    font-size: 15px;
    box-shadow: 0 0 9px color-mix(in srgb, var(--hunter-frame-glow, #d6a94f) 42%, transparent);
}

.hunter-avatar-frame-option-copy {
    min-width: 0;
}

.hunter-avatar-frame-option-copy strong,
.hunter-avatar-frame-option-copy small {
    display: block;
}

.hunter-avatar-frame-option-copy strong {
    overflow: hidden;
    color: inherit;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hunter-avatar-frame-option-copy small {
    margin-top: 3px;
    color: #78716c;
    font-size: 9px;
    font-weight: 750;
    line-height: 1.35;
}

.hunter-avatar-frame-option.is-selected .hunter-avatar-frame-option-copy small {
    color: #047857;
}

.hunter-avatar-frame-empty {
    grid-column: 1 / -1;
    border: 1px dashed #d6d3d1;
    border-radius: 12px;
    padding: 14px;
    color: #78716c;
    font-size: 11px;
    text-align: center;
}

body.hunter-character-modal-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .hunter-character-modal {
        align-items: flex-end;
        padding: 12px;
    }

    .hunter-character-modal-panel {
        width: 100%;
        max-height: min(720px, calc(100dvh - 24px));
        padding: 18px 14px max(14px, env(safe-area-inset-bottom));
        border-radius: 22px;
    }

    .hunter-character-modal-roster {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .hunter-avatar-frame-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 3px;
    }

    .hunter-avatar-frame-heading small { text-align: left; }

    .hunter-avatar-frame-list {
        grid-template-columns: 1fr 1fr;
        gap: 7px;
    }

    .hunter-avatar-frame-option {
        grid-template-columns: 34px minmax(0, 1fr);
        gap: 7px;
        min-height: 54px;
        padding: 7px;
    }

    .hunter-avatar-frame-swatch {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 13px;
    }

    .hunter-character-modal-roster .hunter-character-image {
        width: 112px;
        height: 112px;
    }
}

@media (max-width: 360px) {
    .hunter-avatar-frame-list {
        grid-template-columns: 1fr;
    }

    .hunter-avatar-frame-option {
        min-height: 48px;
    }
}
