.theme-account-note {
    margin: 0 0 12px;
    padding: 10px 0;
    border-top: 1px solid var(--divider-color);
    color: var(--secondary-text);
    font-size: 0.84rem;
    line-height: 1.45;
}

.theme-store-sheet {
    position: fixed;
    inset: 50% auto auto 50%;
    z-index: 1200;
    display: flex;
    max-height: min(860px, calc(100dvh - 32px));
    padding: 24px;
    overflow: hidden;
    flex-direction: column;
    width: min(1040px, calc(100vw - 32px));
    box-sizing: border-box;
    opacity: 0;
    transform: translate(-50%, calc(-50% + 12px));
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
}

.theme-store-sheet.open {
    opacity: 1;
    transform: translate(-50%, -50%);
    pointer-events: auto;
}

.theme-store-sheet .sheet-header > div {
    display: grid;
    gap: 2px;
}

.theme-store-sheet h2,
.theme-store-sheet h3,
.theme-store-sheet p {
    margin: 0;
}

.theme-store-gate {
    display: flex;
    min-height: 420px;
    padding: 40px 28px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 14px;
}

.theme-store-gate > p {
    max-width: 48ch;
    color: var(--secondary-text);
    line-height: 1.55;
}

.theme-gate-preview,
.theme-store-preview {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--divider-color);
    grid-template-columns: repeat(2, 1fr);
}

.theme-gate-preview {
    width: 88px;
    height: 88px;
    margin-bottom: 8px;
}

.theme-gate-preview i:nth-child(1) { background: var(--global-bg); }
.theme-gate-preview i:nth-child(2) { background: var(--hint-bg-highlight); }
.theme-gate-preview i:nth-child(3) { background: var(--cell-fill); }
.theme-gate-preview i:nth-child(4) { background: var(--cell-cross); }

.theme-store-content {
    display: grid;
    padding: 20px;
    gap: 20px;
    overflow-y: auto;
}

.theme-publish-panel,
.theme-stat-section {
    display: grid;
    padding: 16px;
    border: 1px solid var(--divider-color);
    gap: 14px;
}

#theme-publish-form {
    display: grid;
    align-items: end;
    gap: 10px;
    grid-template-columns: minmax(130px, 0.8fr) minmax(180px, 1.4fr) auto;
}

.theme-store-stats,
.theme-card-metrics {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.theme-store-stats > div,
.theme-card-metrics > div {
    display: grid;
    padding: 8px;
    border-left: 1px solid var(--divider-color);
    gap: 2px;
}

.theme-store-stats > div:first-child,
.theme-card-metrics > div:first-child {
    border-left: 0;
}

.theme-store-stats strong,
.theme-card-metrics strong {
    color: var(--primary-text);
    font-size: 1.05rem;
}

.theme-store-stats span,
.theme-card-metrics span {
    color: var(--secondary-text);
    font-size: 0.72rem;
}

.theme-store-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
}

#theme-store-status {
    min-height: 24px;
    color: var(--secondary-text);
}

.theme-store-list {
    display: grid;
    margin: 0;
    padding: 0;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    list-style: none;
}

.theme-store-card {
    display: grid;
    padding: 16px;
    border: 1px solid var(--divider-color);
    background: var(--menu-bg);
    gap: 12px;
    align-content: start;
}

.theme-store-card > header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.theme-store-card-featured {
    grid-template-columns: minmax(0, 1fr) auto;
    border-top: 3px solid var(--cell-fill);
}

.theme-store-card-featured > header {
    align-items: flex-start;
}

.theme-store-card-featured .theme-store-preview {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
}

.theme-store-card-featured .theme-card-use {
    align-self: center;
}

.theme-card-badge {
    display: inline-block;
    margin-bottom: 2px;
    color: var(--secondary-text);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.theme-store-group-heading {
    display: grid;
    padding: 6px 0 0;
    gap: 2px;
    grid-column: 1 / -1;
}

.theme-store-group-heading p {
    max-width: 64ch;
    color: var(--secondary-text);
    font-size: 0.84rem;
}

.theme-store-card header p,
.theme-store-card > p {
    color: var(--secondary-text);
    font-size: 0.82rem;
}

.theme-store-preview {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
}

.theme-card-metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-block: 1px solid var(--divider-color);
}

.theme-card-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.theme-store-list > .theme-store-card:not(.theme-store-card-featured) {
    grid-column: 1 / -1;
}

.theme-icon-button {
    display: inline-flex;
    padding: 0 10px;
    align-items: center;
    gap: 5px;
}

.theme-icon-button svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
}

.theme-icon-button[aria-pressed="true"] {
    color: var(--button-text);
    background: var(--button-active-bg);
}

.theme-report {
    position: relative;
    margin-left: auto;
}

.theme-report summary {
    display: grid;
    min-height: 44px;
    padding: 0 8px;
    cursor: pointer;
    align-items: center;
    color: var(--secondary-text);
    text-decoration: underline;
}

.theme-report form {
    position: absolute;
    right: 0;
    z-index: 4;
    display: grid;
    width: min(300px, 75vw);
    padding: 12px;
    border: 1px solid var(--divider-color);
    background: var(--menu-bg);
    gap: 10px;
}

.theme-report label {
    display: grid;
    color: var(--secondary-text);
    font-size: 0.8rem;
    gap: 4px;
}

.theme-report textarea {
    min-height: 88px;
    padding: 8px;
    border: 1px solid var(--divider-color);
    border-radius: 0;
    resize: vertical;
}

.theme-store-empty {
    padding: 28px 16px;
    border: 1px dashed var(--divider-color);
    color: var(--secondary-text);
    text-align: center;
    grid-column: 1 / -1;
}

@media (max-width: 700px) {
    .theme-store-sheet {
        inset: 0;
        width: 100%;
        max-height: 100dvh;
        padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
        transform: translateY(12px);
    }
    .theme-store-sheet.open { transform: none; }
    #theme-publish-form { grid-template-columns: 1fr; }
    .theme-store-stats { grid-template-columns: repeat(2, 1fr); }
    .theme-store-stats > div { border: 0; border-top: 1px solid var(--divider-color); }
    .theme-store-toolbar { align-items: stretch; flex-direction: column; }
    .theme-store-list { grid-template-columns: 1fr; }
    .theme-store-card-featured { grid-template-columns: 1fr; }
    .theme-store-card-featured .theme-card-use { width: 100%; }
    .theme-card-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .theme-card-metrics > div:nth-child(3) { border-left: 0; }
    .theme-report { margin-left: 0; }
}
