@charset "UTF-8";

/* =========================================
   1. 変数定義 (CSS Variables)
   ========================================= */
:root {
    --primary: #0f172a;
    --primary-hover: #1e293b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --bg-body: #e2e8f0;
    --bg-sidebar: #ffffff;
    --bg-card: #f8fafc;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --border: #cbd5e1;
    --border-light: #e2e8f0;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --bg-main: #ffffff;
    --bg-accent-tint: #eff6ff;
    --color-danger: #ef4444;
    --text-muted: #94a3b8;
    color-scheme: light;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-body);
    margin: 0;
    color: var(--text-main);
}

.material-symbols-outlined {
    vertical-align: middle;
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-spin {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    height: 52px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-light);
    z-index: 500;
    position: relative;
    min-width: 0;
}

@media (max-width: 480px) {
    .app-header {
        padding: 0 12px;
        height: 48px;
    }
}

.header-logo {
    height: 18px;
    width: auto;
}

.header-auth {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 4px;
}

.header-user-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

@media (max-width: 480px) {
    .header-user-wrap {
        gap: 6px;
    }

    .reset-usage-btn {
        font-size: 0.65rem;
        padding: 2px 5px;
    }

    .header-export-remaining {
        font-size: 0.68rem;
        padding: 2px 6px;
    }

    .auth-plan-badge {
        font-size: 0.65rem;
        padding: 2px 6px;
    }
}

/* アバターアイコンボタン */
.header-user-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
}

.header-avatar-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    user-select: none;
    transition: opacity 0.15s;
    overflow: hidden;
}

.header-user-trigger:hover .header-avatar-icon {
    opacity: 0.85;
}

/* ポップアップ */
.header-user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    min-width: 220px;
    overflow: hidden;
    z-index: 600;
}

@media (max-width: 480px) {
    .header-user-dropdown {
        right: -12px;
        min-width: 200px;
    }
}

.header-user-wrap.open .header-user-dropdown {
    display: block;
}

/* ポップアップ上部プロフィールエリア */
.header-popup-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px 16px;
    gap: 4px;
}

.header-popup-avatar-wrap {
    position: relative;
    margin-bottom: 8px;
}

.header-popup-avatar {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    overflow: hidden;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* アバターホバー時のカメラオーバーレイ（ヘッダーポップアップ・マイページ共通） */
.avatar-camera-overlay {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.18s;
    pointer-events: none;
}

.avatar-camera-overlay .material-symbols-outlined {
    font-size: 22px;
    color: #fff;
}

.header-popup-avatar:hover .avatar-camera-overlay {
    opacity: 1;
}

.header-popup-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
}

.header-popup-email {
    font-size: 0.78rem;
    color: var(--text-sub);
    text-align: center;
    word-break: break-all;
}

.header-popup-divider {
    height: 1px;
    background: var(--border-light);
    margin: 0;
}

.header-popup-plan-info {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.8rem;
    color: var(--text-sub);
    border-bottom: 1px solid var(--border-light);
}

.popup-export-remaining {
    font-size: 0.75rem;
    font-weight: 600;
}

@media (max-width: 768px) {
    .header-popup-plan-info {
        display: flex;
    }
}

/* メニュー項目 */
.header-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-sidebar);
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
}

.header-dropdown-item:hover {
    background: var(--bg-card);
}

.header-dropdown-item--active {
    background: var(--bg-card);
    font-weight: 500;
}

.header-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.header-dropdown-item .material-symbols-outlined {
    font-size: 18px;
    color: var(--text-sub);
}

/* ヘッダー追加後のメインレイアウト調整 */
.app-body {
    flex: 1;
    display: flex;
    flex-direction: row;
    overflow: hidden;
    min-height: 0;
}

.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 40px;
    width: 100%;
}

.welcome-logo {
    width: 300px;
    max-width: 80%;
    margin-bottom: 40px;
    opacity: 0.8;
}

.welcome-footer {
    margin-top: 40px;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.welcome-footer p {
    margin: 4px 0;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    min-height: 0;
    min-width: 0;
}

.preview-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 16px;
    min-height: 0;
    padding: 24px 24px 12px 24px;
    box-sizing: border-box;
}

#canvas-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    flex: 1;
    padding: 20px 20px 0 20px;
    box-sizing: border-box;
}

canvas {
    display: block;
    max-width: calc(100% - 60px);
    max-height: calc(100% - 60px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 6px;
    transition: box-shadow 0.3s ease;
}

#canvas-container.has-image canvas {
    box-shadow: 0 15px 40px -5px rgba(0, 0, 0, 0.3);
}

.pagination-box {
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex-shrink: 0;
    z-index: 10;
}

.page-nav-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: var(--text-main);
    transition: background 0.2s;
}

.page-nav-btn:hover:not(:disabled) {
    background: #f1f5f9;
}

.page-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.page-nav-btn .material-symbols-outlined {
    font-size: 24px;
}

.page-counter-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 24px;
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
    font-weight: bold;
    color: var(--text-main);
    font-size: 14px;
    min-width: 130px;
    font-variant-numeric: tabular-nums;
}

.filmstrip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 0 0;
    margin-top: 0;
    max-width: 100%;
    flex-shrink: 0;
    z-index: 10;
    scrollbar-width: none;
    user-select: none;
}

.filmstrip::-webkit-scrollbar {
    display: none;
}

.filmstrip-item {
    width: 64px;
    height: 42px;
    border-radius: 4px;
    background-size: 110%;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    opacity: 0.5;
    transition: 0.2s;
    flex-shrink: 0;
    border: 2px solid transparent;
}

.filmstrip-item:hover {
    opacity: 0.8;
}

.filmstrip-item.active {
    opacity: 1;
    border-color: var(--accent);
}

.filmstrip-edit-btn {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    border: 2px solid var(--border-light);
    background: var(--bg-card);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.2s;
}

.filmstrip-edit-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filmstrip-edit-btn .material-symbols-outlined {
    font-size: 18px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    width: 80vw;
    max-width: 1000px;
    height: 85vh;
    max-height: 800px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .modal-content {
        width: 95vw;
        height: 90vh;
        max-height: none;
        padding: 14px;
        border-radius: 10px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--primary);
}

.modal-close-btn {
    background: #f1f5f9;
    border: 1px solid var(--border);
    cursor: pointer;
    color: var(--text-main);
    padding: 0;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
    box-shadow: var(--shadow-sm);
}

.modal-close-btn .material-symbols-outlined {
    font-size: 20px;
}

.modal-close-btn:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
}

.modal-body {
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    align-content: flex-start;
}

.grid-item-wrapper {
    position: relative;
    aspect-ratio: 3/2;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: 0.2s;
    background: #eee;
}

.grid-item-wrapper.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.grid-item-bg {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.grid-item-wrapper:hover .grid-item-bg {
    transform: scale(1.05);
}

.delete-img-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 2;
}

.delete-img-btn:hover {
    background: #ef4444;
}

.sidebar {
    width: 420px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-light);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.03);
    z-index: 10;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: none;
}

.sidebar-logo {
    width: 180px;
    max-width: 100%;
}

.sidebar-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    scrollbar-width: thin;
}

.sidebar-content::-webkit-scrollbar {
    width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.sidebar-action {
    flex-shrink: 0;
    padding: 16px 24px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-sidebar);
}

.mobile-tab-bar {
    display: none;
}

.mobile-sub-nav {
    display: none;
}

.sidebar-notes {
    font-size: 0.75rem;
    color: var(--text-sub);
    line-height: 1.4;
    padding: 16px;
}

.sidebar-notes p {
    margin: 4px 0;
}

.radio-group {
    display: grid;
    gap: 8px;
}

.radio-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.radio-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.radio-grid-4 {
    grid-template-columns: 1fr 1fr 1fr 1fr;
}

.radio-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-sidebar);
    cursor: pointer;
    transition: 0.2s ease;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: center;
}

.radio-card input[type="radio"] {
    display: none;
}

.radio-card:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: #eff6ff;
    color: var(--accent);
}

.radio-card .material-symbols-outlined {
    font-size: 18px;
}

.font-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 16px;
}

.font-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-sidebar);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.8rem;
    color: var(--text-main);
    text-align: center;
}

.font-card input[type="radio"] {
    display: none;
}

.font-card:has(input[type="radio"]:checked) {
    border-color: var(--accent);
    background: #eff6ff;
    color: var(--accent);
    font-weight: bold;
}

.checkbox-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.info-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-sidebar);
    cursor: pointer;
    transition: 0.2s ease;
    font-size: 0.7rem;
    color: var(--text-sub);
    text-align: center;
}

.info-card input[type="checkbox"] {
    display: none;
}

.info-card:has(input[type="checkbox"]:checked) {
    border-color: var(--accent);
    background: #eff6ff;
    color: var(--accent);
    font-weight: bold;
}

.section-title {
    font-weight: bold;
    color: var(--primary);
    display: block;
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.section-title-row .section-title {
    margin-bottom: 0;
}

.unit-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.unit-toggle-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: 0.15s;
    user-select: none;
}

.unit-toggle-item input {
    display: none;
}

.unit-toggle-item:has(input:checked),
.unit-toggle-item.active {
    background: var(--accent);
    color: #fff;
}

.section-divider {
    border: 0;
    border-top: 1px dashed var(--border);
    margin: 20px 0;
}

.label-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.val-input-wrap {
    display: flex;
    align-items: center;
    gap: 2px;
    background: #eff6ff;
    color: var(--accent);
    border: 1px solid #bfdbfe;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.val-input {
    border: none;
    background: transparent;
    width: 36px;
    text-align: right;
    font-weight: bold;
    color: inherit;
    font-size: inherit;
    outline: none;
    padding: 0;
    margin: 0;
    font-family: inherit;
}

.val-input::-webkit-outer-spin-button,
.val-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.slider-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0 20px 0;
}

.slider-wrap input[type="range"] {
    margin: 0;
    flex: 1;
}

.slider-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-sub);
    transition: 0.2s;
    flex-shrink: 0;
}

.slider-btn:hover {
    background: var(--border-light);
    color: var(--text-main);
    border-color: #94a3b8;
}

.slider-btn .material-symbols-outlined {
    font-size: 16px;
}

#placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-sub);
    gap: 16px;
}

#placeholder p {
    font-size: 0.95rem;
    font-weight: 600;
    text-align: center;
    margin: 0;
}

h1 {
    font-size: 1.5rem;
    margin: 0;
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.8rem;
    padding: 8px 0;
    width: 100%;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

.control-group {
    background: var(--bg-sidebar);
    padding: 0;
    border-radius: 0;
    border: none;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 0;
}

.control-group h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.accordion-header {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    margin: 0;
    border: none;
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 5;
    transition: background 0.15s;
}

.accordion-header:hover {
    background: #eef2f7;
}

.accordion-header .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent);
}

.accordion-header .accordion-chevron {
    margin-left: auto;
    font-size: 20px;
    color: var(--text-muted);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-header[aria-expanded="false"] .accordion-chevron {
    transform: rotate(-90deg);
}

.accordion-body {
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.accordion-body.collapsed {
    max-height: 0 !important;
}

.accordion-body-inner {
    padding: 16px;
}

.control-group h3 .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent);
}

label {
    font-size: 0.85rem;
    color: var(--text-sub);
    font-weight: 600;
    cursor: pointer;
}

.upload-dropzone {
    border: 2px dashed #94a3b8;
    border-radius: var(--radius-lg);
    background-color: #f8fafc;
    padding: 32px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 12px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--accent);
    background-color: #eff6ff;
}

.dropzone-main {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
}

.dropzone-sub {
    margin: 6px 0 0 0;
    font-size: 0.75rem;
    color: var(--text-sub);
}

.logo-dropzone {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background-color: var(--bg-card);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-sub);
}

.logo-dropzone:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

select {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    box-sizing: border-box;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all 0.2s;
    background: none;
    color: var(--text-main);
    font-family: inherit;
}

select:focus {
    outline: none;
    border-color: var(--accent);
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-light);
    border-radius: 4px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

input[type="color"] {
    width: 100%;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 3px;
    background: #fff;
}

.override-accordion {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: 12px;
}

.override-accordion summary {
    padding: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.override-accordion summary::after {
    content: "\e5c5";
    font-family: 'Material Symbols Outlined';
    font-size: 1.2rem;
    color: var(--text-sub);
    transition: transform 0.2s;
}

.override-accordion[open] summary::after {
    transform: rotate(180deg);
}

.override-hint {
    padding: 4px 12px 10px;
    margin: 0;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.override-container {
    padding: 0 12px 12px 12px;
    border-top: 1px solid var(--border-light);
}

.override-item {
    margin-top: 12px;
}

.override-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn {
    background: linear-gradient(135deg, var(--accent), #2563eb);
    color: white;
    border: none;
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    transition: all 0.2s ease;
}

.btn:hover:not(:disabled) {
    opacity: 0.9;
}

.btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
}

#progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
}

.progress-box {
    position: relative;
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    padding: 32px 36px;
    text-align: center;
    width: 480px;
    max-width: 90vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@media (max-width: 480px) {
    .progress-box {
        padding: 24px 18px;
        max-width: 94vw;
    }
}

.progress-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

.progress-ad {
    border-radius: var(--radius-md);
    margin: 16px 0 0;
    overflow: hidden;
}

/* ─── Amazon 3×2 商品グリッド ─── */
.amazon-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    position: relative;
    aspect-ratio: 16 / 9;
}

.amazon-grid-badge {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 0.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 3px;
    z-index: 1;
}

.amazon-grid-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    background: #fff;
    border-radius: 6px;
    text-decoration: none;
    overflow: hidden;
}

.amazon-grid-item:hover {
    opacity: 1;
}

.amazon-grid-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.amazon-grid-name {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.55rem;
    font-weight: 600;
    color: #fff;
    text-align: center;
    line-height: 1.3;
    padding: 4px;
    background: rgba(0,0,0,0.6);
    opacity: 0;
    transition: opacity 0.2s;
}

.amazon-grid-item:hover .amazon-grid-name {
    opacity: 1;
}

/* サイドバー内 */
.ad-slot-sidebar .amazon-grid {
    border-radius: 0;
}

.ad-slot-sidebar .amazon-grid-name {
    font-size: 0.55rem;
}

.ad-slot-sidebar .amazon-grid-badge {
    color: var(--text-sub);
    background: color-mix(in srgb, var(--text-sub) 15%, transparent);
}

@media (max-width: 1024px) {
    .app-body {
        flex-direction: column;
        overflow-y: auto;
    }

    .main-content {
        order: 1;
        position: sticky;
        top: 0;
        height: 40vh;
        min-height: 220px;
        z-index: 100;
        border-bottom: 2px solid var(--border);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    }

    .sidebar {
        order: 2;
        width: 100%;
        height: auto;
        border-left: none;
        overflow: visible;
    }

    .sidebar-content {
        overflow-y: visible;
    }
}

/* =========================================
   色のセクション（カラーピッカー）用スタイル
   ========================================= */

.color-picker-group {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.color-picker-custom {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0;
    border: 1px solid var(--border-light);
    border-radius: 4px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: none;
}

.color-picker-custom::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker-custom::-webkit-color-swatch {
    border: none;
    border-radius: 3px;
}

.color-picker-custom::-moz-color-swatch {
    border: none;
    border-radius: 3px;
}

/* =========================================
   テキスト入力の共通スタイル
   ========================================= */
.custom-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
    font-family: inherit;
    background: none;
    color: var(--text-main);
    transition: border-color 0.2s;
    margin-top: 12px;
}

.custom-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.custom-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
    background: none;
    color: var(--text-main);
    transition: border-color 0.2s;
    margin-top: 12px;
}

.custom-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* その他のUI調整 */
.sub-label {
    display: block;
    font-size: 0.8rem;
    margin-bottom: 8px;
    color: var(--text-sub);
}

.add-lower-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--primary);
}

.fill-photo-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--text-main);
}

.logo-label {
    margin-top: 24px;
    margin-bottom: 8px;
    display: block;
    font-size: 0.8rem;
    color: var(--text-main);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    font-weight: bold;
    transition: all 0.2s ease;
}

.btn-outline:hover:not(:disabled) {
    background: #eff6ff;
}

/* =========================================
   プレミアム / 広告 / モーダル
   ========================================= */

.btn-premium {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    animation: premium-pulse 2s ease-in-out infinite;
}

.btn-cancel-subscription {
    background: transparent !important;
    border: 1px solid #ef4444 !important;
    color: #ef4444 !important;
    font-size: 0.8rem;
    margin-top: 0.5rem;
    padding: 0.4rem 1rem;
}

.btn-billing-portal {
    background: transparent !important;
    border: 1px solid var(--border) !important;
    color: var(--text-sub) !important;
    font-size: 0.8rem;
    margin-top: 1rem;
    padding: 0.4rem 1rem;
    width: 100%;
}

.btn-billing-portal:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* エクスポート利用状況バー */
.export-usage-bar {
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    background: var(--bg-card);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.export-usage-unlimited {
    color: var(--text-sub);
}

.export-usage-text {
    display: block;
    font-size: 0.78rem;
    color: var(--text-sub);
    margin-bottom: 0.4rem;
}

.export-usage-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.export-usage-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.export-usage-fill.usage-warning {
    background: #f59e0b;
}

.export-usage-fill.usage-full {
    background: #ef4444;
}

/* プランセクションの表示切り替え */
.plan-section-free,
.plan-section-light,
.plan-section-ad-free,
.plan-section-premium {
    display: none;
}

body.plan-free .plan-section-free {
    display: block;
}

body.plan-light .plan-section-light {
    display: block;
}

body.plan-premium .plan-section-premium {
    display: block;
}

/* プレミアムではドロップダウンのプラン変更を非表示 */
body.plan-premium #auth-manage-plan-btn {
    display: none;
}

/* ============================================
   非ログイン時のアクセス制御
   ============================================ */

/* ログイン時にゲスト向けヒントを非表示 */

body.user-logged-in .dropzone-guest-hint {
    display: none;
}

.download-btn-wrap {
    position: relative;
}

.premium-feature-note {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -28px;
    font-size: 0.7rem;
    color: var(--text-sub);
    text-align: center;
    line-height: 1;
    pointer-events: none;
}

/* 非ログイン時にプレミアム機能エリアをロック */
body:not(.user-logged-in) .premium-gate {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
}

/* タブの表示制御: ログイン中はログイン/新規登録タブを非表示 */
body.user-logged-in .auth-tab-btn[data-tab="login"],
body.user-logged-in .auth-tab-btn[data-tab="signup"] {
    display: none;
}

/* 未ログイン時はプランタブを非表示 */
body:not(.user-logged-in) .auth-tab-btn[data-tab="plan"] {
    display: none;
}

.plan-current-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    color: #166534;
}

.plan-current-notice .material-symbols-outlined {
    font-size: 20px;
    color: #22c55e;
}

.plan-current-premium {
    background: #fefce8;
    border-color: #fde047;
    color: #713f12;
}

.plan-current-premium .material-symbols-outlined {
    color: #f59e0b;
}

@keyframes premium-pulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(245, 158, 11, 0);
    }
}

/* プレミアム設定クラウンバッジ */
.premium-crown {
    display: none;
    font-size: 14px !important;
    color: #f59e0b;
    flex-shrink: 0;
    cursor: default;
}

body:not(.plan-premium) .premium-crown {
    display: inline-block;
}

.plan-premium .premium-crown {
    display: none !important;
}

/* セクションラベル + クラウンの横並びラッパー */
.premium-label-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.premium-label-wrap .section-title,
.premium-label-wrap .sub-label {
    margin-bottom: 0;
}

/* 設定保存/読込ボタングループのクラウン用ラッパー */
.premium-setting-wrap {
    position: relative;
}

.premium-setting-wrap>.premium-crown {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 14px !important;
}

/* ラジオカード内クラウン（右上角）*/
.radio-card {
    position: relative;
}

.radio-card .premium-crown {
    position: absolute;
    top: 3px;
    right: 3px;
    font-size: 11px !important;
}

.ad-slot-sidebar {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* モバイル広告スロット（PC では非表示） */
.ad-slot-mobile {
    display: none !important;
}

#ad-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 20000;
    display: none;
    align-items: center;
    justify-content: center;
}

.ad-modal-box {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: min(480px, 90vw);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.ad-modal-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #16a34a;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ad-modal-ad {
    min-height: 100px;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    overflow: hidden;
}

.ad-modal-countdown {
    color: var(--text-sub);
    font-size: 0.85rem;
    margin: 0 0 12px;
}

#upsell-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 20001;
    display: none;
    align-items: center;
    justify-content: center;
}

.upsell-modal-box {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    width: min(400px, 90vw);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.upsell-icon {
    font-size: 3rem !important;
    color: #f59e0b;
    display: block;
    margin-bottom: 12px;
}

.upsell-title {
    margin: 0 0 10px;
    font-size: 1.15rem;
}

.upsell-desc {
    color: var(--text-sub);
    font-size: 0.9rem;
    margin: 0 0 24px;
    line-height: 1.6;
}

.upsell-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upsell-actions .btn,
.upsell-actions .btn-outline {
    width: 100%;
}

.aspect-custom-wrap {
    display: flex;
    gap: 10px;
    align-items: center;
}

.aspect-custom-wrap input {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    box-sizing: border-box;
    font-family: inherit;
    background: none;
    color: var(--text-main);
    transition: border-color 0.2s;
}

.aspect-custom-wrap input:focus {
    outline: none;
    border-color: var(--accent);
}

.action-btn-group {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 8px;
}

/* =========================================
   テンプレート UI
   ========================================= */

.template-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 0;
}

.template-save-btn {
    margin-bottom: 0;
    font-size: 0.8rem;
    padding: 10px 12px;
    white-space: nowrap;
}

.template-secondary {
    background: none;
    color: var(--accent);
    border-color: var(--accent);
}

.template-secondary:hover {
    background: #eff6ff;
}

.template-apply-row {
    display: flex;
    gap: 6px;
    align-items: stretch;
    position: relative;
}

.template-search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

.template-search-input {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    background: #fff;
    color: var(--text-main);
    outline: none;
}

.template-search-input:focus {
    border-color: var(--accent);
}

.template-apply-btn {
    flex-shrink: 0;
    white-space: nowrap;
    width: 20%;
    padding: 0 8px;
    font-size: 0.82rem;
    background: #222 !important;
    color: #fff !important;
    border-color: #222 !important;
    align-self: stretch;
}

.template-apply-btn:hover {
    background: #444 !important;
    border-color: #444 !important;
}

body:not(.plan-premium) .template-apply-row {
    display: none;
}

body:not(.plan-premium) .template-save-crown {
    display: inline-block;
}

.plan-premium .template-save-crown {
    display: none !important;
}

body:not(.user-logged-in) .template-save-btn {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

.template-suggestions {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    z-index: 800;
    max-height: 220px;
    overflow-y: auto;
}

.template-suggestion-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.15s;
}

.template-suggestion-thumb {
    width: 52px;
    height: 35px;
    object-fit: cover;
    border-radius: 3px;
    flex-shrink: 0;
    background: #eee;
}

.template-suggestion-thumb-empty {
    width: 52px;
    height: 35px;
    border-radius: 3px;
    flex-shrink: 0;
    background: #eee;
}

.template-suggestion-item:last-child {
    border-bottom: none;
}

.template-suggestion-item:hover,
.template-suggestion-item.selected {
    background: #eff6ff;
    color: var(--accent);
}

.template-suggestion-empty {
    padding: 12px;
    font-size: 0.82rem;
    color: var(--text-sub);
    text-align: center;
}

/* テンプレートオーバーレイ共通 */
.template-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 21000;
    align-items: center;
    justify-content: center;
}

.template-modal-box {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 420px;
    max-width: calc(100vw - 24px);
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

@media (max-width: 480px) {
    .template-modal-box {
        padding: 18px;
        max-width: calc(100vw - 16px);
        max-height: 90vh;
        border-radius: 10px;
    }

    .template-manage-box {
        width: calc(100vw - 16px);
    }
}

/* 保存モーダル: 上部固定ヘッダー＋下部固定フッター */
.template-save-box {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}

.template-save-box .modal-header {
    padding: 20px 24px 16px;
    margin-bottom: 0;
}

.template-save-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.template-save-footer {
    flex-shrink: 0;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
}

.template-save-footer .btn {
    width: 100%;
}

.template-manage-box {
    width: 520px;
}

.template-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.template-modal-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
}

.template-modal-header .template-modal-title {
    margin-bottom: 0;
}

/* 保存モーダル: 設定概要 */
.template-name-wrap {
    position: relative;
    margin-bottom: 16px;
}

.template-name-input {
    padding-right: 36px !important;
    width: 100%;
    box-sizing: border-box;
}

.template-name-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.12s;
}

.template-name-clear-btn:hover {
    color: var(--text-main);
}

.template-name-clear-btn .material-symbols-outlined {
    font-size: 18px;
}

.template-desc-input {
    width: 100%;
    resize: vertical;
    min-height: 56px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.template-summary-list {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
    font-size: 0.83rem;
}

.template-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-sub);
    gap: 8px;
}

.template-summary-item:last-child {
    border-bottom: none;
}

.template-summary-item span:first-child {
    color: var(--text-main);
    font-weight: 500;
    flex-shrink: 0;
}

/* 保存モーダル: ボタン */
.template-modal-btns {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.template-modal-btns .btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sub);
}

/* 管理モーダル */
.template-load-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -8px 0 12px;
}
.template-manage-count {
    font-size: 0.8rem;
    color: var(--text-sub);
    margin: 0;
}
.template-load-controls .tmpl-sort-select {
    font-size: 0.72rem;
    padding: 2px 4px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-main);
    color: var(--text-sub);
    cursor: pointer;
    width: auto;
    flex-shrink: 0;
}

.template-manage-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-manage-item {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.template-manage-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.template-manage-header:hover {
    background: #f5f7fa;
}

.template-manage-thumb {
    width: 64px;
    height: 43px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: #e2e8f0;
}

.template-manage-thumb-empty {
    width: 64px;
    height: 43px;
    border-radius: 4px;
    flex-shrink: 0;
    background: #e2e8f0;
}

.template-manage-info {
    flex: 1;
    min-width: 0;
}

.template-manage-name {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-manage-date {
    display: block;
    font-size: 0.75rem;
    color: var(--text-sub);
    margin-top: 2px;
}

.template-manage-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.template-action-btn {
    padding: 4px 10px;
    font-size: 0.78rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    color: var(--text-sub);
    transition: 0.15s;
    white-space: nowrap;
}

.template-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: #eff6ff;
}

.template-delete-btn:hover {
    border-color: #ef4444;
    color: #ef4444;
    background: #fef2f2;
}

.template-manage-accordion {
    display: none;
    border-top: 1px solid var(--border-light);
    padding: 10px 12px;
    background: #fff;
}

.template-manage-accordion.open {
    display: block;
}

.template-accordion-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
    font-size: 0.8rem;
    color: var(--text-sub);
}

.template-accordion-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    padding: 3px 0;
    border-bottom: 1px solid var(--border-light);
}

.template-accordion-row:last-child {
    border-bottom: none;
}

.template-accordion-row span:first-child {
    font-weight: 500;
    color: var(--text-main);
    flex-shrink: 0;
}

.template-manage-empty {
    color: var(--text-sub);
    font-size: 0.85rem;
    text-align: center;
    padding: 24px 0;
}

.template-load-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-sub);
    font-size: 0.85rem;
    padding: 40px 0;
    grid-column: 1 / -1;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinning { animation: spin 1s linear infinite; }

/* トースト通知 */
.template-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(16px);
    background: var(--primary, #1e293b);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.85rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 31000;
    white-space: nowrap;
}

.template-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =========================================
   テンプレート読み込みモーダル
   ========================================= */
.template-load-box {
    max-width: 960px;
    width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.template-load-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    overflow-y: auto;
    padding: 4px;
    flex: 1;
}

@media (max-width: 480px) {
    .template-load-box {
        width: calc(100vw - 16px);
        max-height: 90vh;
        padding: 16px;
    }

    .template-load-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }

    .template-load-list-item {
        min-height: 120px;
    }

    .template-load-list-thumb-wrap {
        width: 100px;
        min-width: 100px;
        min-height: 100px;
    }

    .template-load-list-thumb {
        width: 100px;
        height: 100px;
    }

    .template-load-list-thumb-empty {
        width: 100px;
        height: 100px;
    }

    .template-load-list-info {
        padding: 10px 12px;
    }

    .template-load-list-title {
        font-size: 0.9rem;
    }

    .template-load-list-table {
        font-size: 0.72rem;
    }

    .tl-groups-wrap {
        gap: 8px;
    }
}

.template-load-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.template-load-thumb-wrap {
    aspect-ratio: 1 / 1;
    width: 100%;
    background: #f1f5f9;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.template-load-item:hover .template-load-thumb-wrap {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18);
}

.template-load-item.selected .template-load-thumb-wrap {
    border-color: var(--accent);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.18);
}

.template-load-thumb {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.template-load-thumb-empty {
    width: 100%;
    height: 100%;
    background: #e2e8f0;
}

.template-load-name {
    font-size: 0.78rem;
    font-weight: 500;
    text-align: center;
    color: #334155;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* =========================================
   テンプレート読み込み: ビュートグル
   ========================================= */
.template-view-toggle {
    display: flex;
    gap: 4px;
    margin-left: auto;
    margin-right: 8px;
}

.template-view-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text-sub);
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.template-view-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.template-view-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.template-view-btn .material-symbols-outlined {
    font-size: 18px;
}

/* =========================================
   テンプレート読み込み: リストビュー
   ========================================= */
.template-load-grid.list-mode {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.template-load-list-item {
    display: flex;
    align-items: stretch;
    gap: 0;
    min-height: 160px;
    cursor: pointer;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.template-load-list-item:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.15);
}

.template-load-list-thumb-wrap {
    width: 160px;
    min-width: 160px;
    min-height: 160px;
    align-self: stretch;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.template-load-list-thumb {
    width: 160px;
    height: 160px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    border-right: 1px solid var(--border-light);
}

.template-load-list-thumb-empty {
    width: 160px;
    height: 160px;
    flex-shrink: 0;
    background: #e2e8f0;
}

.template-load-list-info {
    flex: 1;
    min-width: 0;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
}

.tl-date {
    font-size: 0.72rem;
    color: var(--text-sub);
}

.template-load-list-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.4;
    word-break: break-all;
}

.template-load-list-table {
    border-collapse: collapse;
    font-size: 0.78rem;
    white-space: nowrap;
}

.template-load-list-table th {
    padding: 3px 14px 3px 0;
    color: var(--text-sub);
    font-weight: 500;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-light);
}

.template-load-list-table td {
    padding: 4px 14px 0 0;
    color: var(--text-main);
    vertical-align: middle;
}

.tl-groups-wrap {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.tl-tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tl-tag-group + .tl-tag-group {
    border-left: 1px solid var(--border-light);
    padding-left: 14px;
}

.tl-tag {
    font-size: 0.72rem;
    color: var(--text-sub);
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 4px;
    padding: 2px 7px;
    white-space: nowrap;
}

/* =========================================
   背景画像アップロード
   ========================================= */
.bg-image-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    margin-top: 4px;
    transition: border-color 0.15s;
}

.bg-image-upload-area:hover {
    border-color: var(--accent);
}

.bg-image-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    color: #64748b;
}

.bg-image-upload-label .material-symbols-outlined {
    font-size: 18px;
}

.bg-image-preview {
    width: 100%;
    border-radius: 6px;
    margin-top: 8px;
    object-fit: cover;
    max-height: 80px;
}

/* =========================================
   スマートフォン対応
   ========================================= */
* {
    touch-action: manipulation;
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body.app-view {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100dvh;
}

.app-container {
    height: 100dvh;
    display: flex;
}

#main-dropzone {
    max-width: 600px;
    width: 100%;
    padding: 60px 20px;
}

@media (max-width: 768px) {
    .welcome-screen {
        padding: 20px;
        width: 100%;
        height: 100%;
        justify-content: center;
        position: absolute;
        top: 0;
        left: 0;
        z-index: 500;
        background: var(--bg-body);
    }

    #main-dropzone {
        padding: 32px 16px;
        height: auto;
        max-height: 50vh;
    }

    .dropzone-main {
        font-size: 1rem;
    }

    .dropzone-sub {
        font-size: 0.7rem;
    }

    .welcome-logo {
        width: 200px;
        margin-bottom: 24px;
    }

    .welcome-footer {
        margin-top: 24px;
        font-size: 0.72rem;
    }

    .app-body {
        flex-direction: column;
        overflow: hidden;
    }

    .main-content {
        width: 100%;
        flex: 55;
        min-height: 0;
        background: var(--bg-body);
        flex-direction: column;
        padding: 0;
    }

    .preview-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        padding: 0;
        height: 100%;
        gap: 0;
    }

    #canvas-container {
        flex: 1;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: 10px;
    }

    canvas {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    }

    /* ページネーション非表示（スワイプで操作） */
    .pagination-box {
        display: none !important;
    }

    .filmstrip {
        display: flex !important;
        padding: 6px 8px;
        background: var(--bg-sidebar);
        border-top: 1px solid var(--border-light);
        flex-shrink: 0;
    }

    /* 下半分：設定エリア */
    .sidebar {
        width: 100%;
        flex: 45;
        min-height: 0;
        border-left: none;
        border-top: none;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .sidebar-content {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        flex: 1;
        min-height: 0;
    }

    /* 非アクティブ control-group を非表示 */
    .mobile-cg-hidden {
        display: none !important;
    }

    /* 書き出しボタン：ヘッダーに移設 */
    .sidebar-action {
        display: none;
    }

    /* ヘッダー書き出しボタン */
    .header-export-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 4px;
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: var(--radius-sm);
        padding: 5px 12px;
        font-size: 0.75rem;
        font-weight: 600;
        cursor: pointer;
        white-space: nowrap;
        transition: opacity 0.15s;
    }

    .header-export-btn:disabled {
        opacity: 0.4;
        cursor: default;
    }

    .header-export-btn .material-symbols-outlined {
        font-size: 16px;
    }

    /* PC用サイドバー広告は非表示 */
    .ad-slot-sidebar {
        display: none !important;
    }

    /* モバイル広告スロット — 3×2 幅いっぱい */
    .ad-slot-mobile {
        display: block !important;
        margin: 16px -14px 0;
        padding: 0;
        overflow: hidden;
    }

    .ad-slot-mobile .amazon-grid {
        border-radius: 0;
        background: var(--bg-card);
    }

    .ad-slot-mobile .amazon-grid-item {
        background: #fff;
    }

    .ad-slot-mobile .amazon-grid-name {
        position: static;
        font-size: 0.55rem;
        color: #0f1111;
        background: none;
        opacity: 1;
        padding: 2px 2px 0;
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .ad-slot-mobile .amazon-grid-badge {
        color: var(--text-sub);
        background: color-mix(in srgb, var(--text-sub) 15%, transparent);
    }

    /* ─── iOS風サブナビゲーション ─── */

    /* control-groupのカード装飾を除去 */
    .control-group {
        background: none;
        border: none;
        padding: 0;
        margin-bottom: 0;
        border-radius: 0;
    }

    .control-group h3,
    .accordion-header {
        display: none;
    }

    .accordion-body,
    .accordion-body.collapsed {
        max-height: none !important;
        overflow: visible !important;
        transition: none !important;
    }

    .control-group .section-divider {
        display: none;
    }

    /* サブナビストリップ（.sidebar の直接の子） */
    .mobile-sub-nav {
        display: flex !important;
        overflow-x: auto;
        gap: 2px;
        padding: 8px 10px;
        padding-right: 32px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
        flex-shrink: 0;
        border-bottom: 1px solid var(--border-light);
        background: var(--bg-sidebar);
        -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent 100%);
        mask-image: linear-gradient(to right, #000 calc(100% - 32px), transparent 100%);
    }

    .mobile-sub-nav::-webkit-scrollbar {
        display: none;
    }

    /* スクロール末尾でフェード解除 */
    .mobile-sub-nav.scrolled-end {
        -webkit-mask-image: none;
        mask-image: none;
        padding-right: 10px;
    }

    .mobile-sub-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 6px 12px;
        background: none;
        border: none;
        color: var(--text-sub);
        font-size: 0.55rem;
        cursor: pointer;
        flex-shrink: 0;
        border-radius: var(--radius-md);
        transition: color 0.15s, background 0.15s;
        white-space: nowrap;
        min-width: 48px;
    }

    .mobile-sub-nav-item .material-symbols-outlined {
        font-size: 20px;
    }

    .mobile-sub-nav-item.active {
        color: var(--accent);
        background: color-mix(in srgb, var(--accent) 8%, transparent);
    }

    /* アクティブ CG のコンテンツパディング */
    .control-group:not(.mobile-cg-hidden) .accordion-body-inner {
        padding: 14px;
    }

    /* ヘッダーをコンパクトに */
    .app-header {
        height: 44px;
        padding: 0 10px;
    }

    /* ヘッダー：リセット・プラン・残り枚数を非表示（メニュー内に移動） */
    .reset-usage-btn,
    #header-export-remaining,
    #auth-plan-badge {
        display: none !important;
    }

    /* モバイルタブバー（廃止 → サブナビに統合） */
    .mobile-tab-bar {
        display: none !important;
    }

    /* フィルムストリップ編集ボタン（モバイル調整） */
    .filmstrip-edit-btn {
        width: 36px;
        height: 36px;
        align-self: center;
    }

    .filmstrip-edit-btn .material-symbols-outlined {
        font-size: 16px;
    }

    /* チェックボックス（EXIF項目）: 3つ以下→1行、4つ以上→2列ラップ */
    .checkbox-card-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    /* 機材名（メーカー・カメラ・レンズ）は3つなので1行 */
    .checkbox-card-grid:has(> :nth-child(4)) {
        grid-template-columns: 1fr 1fr;
    }

    .checkbox-card-grid:not(:has(> :nth-child(4))) {
        grid-template-columns: repeat(3, 1fr);
    }

    .info-card {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    /* ラジオグループ: 3つ以下→1行均等幅、4つ以上→2列ラップ */
    .radio-group {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        overflow-x: visible;
    }

    .radio-group.radio-grid-3 {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .radio-group.radio-grid-2 {
        grid-template-columns: 1fr 1fr;
    }

    .radio-group.radio-grid-4 {
        grid-template-columns: 1fr 1fr;
    }

    .radio-card {
        padding: 8px 12px;
        font-size: 0.78rem;
    }

    /* フォント選択: 2列ラップ */
    .font-selector {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .font-card {
        padding: 8px 12px;
        font-size: 0.75rem;
    }

    #manage-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .color-picker-group {
        grid-template-columns: repeat(3, 1fr);
    }

    .section-title {
        font-size: 0.88rem;
    }

    /* テンプレートセクション */
    .template-save-btn {
        font-size: 0.75rem;
        padding: 8px 10px;
    }

    /* アクションボタングループ */
    .action-btn-group {
        flex-wrap: wrap;
    }

    .action-btn {
        font-size: 0.75rem;
        padding: 6px 0;
    }

    /* スライダー */
    .slider-wrap {
        margin: 6px 0 16px 0;
    }

    /* アスペクト比カスタム */
    .aspect-custom-wrap input {
        padding: 8px 10px;
        font-size: 0.85rem;
    }
}

/* 超小型デバイス（iPhone SE等） */
@media (max-width: 380px) {
    .sidebar {
        max-height: 45vh;
    }

    .radio-card {
        padding: 6px 10px;
        font-size: 0.72rem;
    }

    .font-card {
        padding: 6px 10px;
        font-size: 0.68rem;
    }

    .info-card {
        padding: 6px 10px;
        font-size: 0.65rem;
    }
}

/* スマホ用プレビュー拡大モーダル */
.preview-modal-img-wrap {
    flex: 1;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.preview-modal-img-wrap img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.preview-modal-close-wrap {
    padding: 16px;
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 24px;
}

#close-preview-modal-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
}

/* =========================================
   認証UI / プランモーダル
   ========================================= */

/* ローディングスピナー */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* サイドバーヘッダーの認証エリア */
.auth-login-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    justify-content: center;
}

.auth-login-btn .material-symbols-outlined {
    font-size: 16px !important;
}

.auth-login-btn:hover {
    background: #1d4ed8;
}

.auth-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.auth-user-email {
    font-size: 0.78rem;
    color: var(--text-sub);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.auth-plan-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

.badge-free {
    background: #f1f5f9;
    color: #64748b;
    border: 1px solid #e2e8f0;
}

.badge-light {
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    color: #1e40af;
}

.badge-premium {
    background: linear-gradient(135deg, #fef9c3, #fde68a, #fbbf24);
    color: #78350f;
    box-shadow: 0 1px 3px rgba(251, 191, 36, 0.25);
}

.header-export-remaining {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    white-space: nowrap;
}

.reset-usage-btn {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
    background: none;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
}

.reset-usage-btn:hover {
    background: #f1f5f9;
    color: #334155;
}

.auth-user-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.auth-user-actions .action-btn {
    flex: 1;
    font-size: 0.78rem;
    padding: 5px 6px;
}

/* 認証モーダル */
.auth-modal-box {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    width: min(420px, 92vw);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@media (max-width: 480px) {
    .auth-modal-box {
        width: 96vw;
        max-height: 92vh;
        border-radius: 10px;
    }

    .auth-modal-header {
        padding: 16px 16px 0;
    }

    .auth-modal-body {
        padding: 16px 16px 20px;
    }

    .auth-tab-btn {
        padding: 6px 10px;
        font-size: 0.82rem;
    }

    .plan-card {
        padding: 12px;
    }

    .plan-features li {
        font-size: 0.8rem;
    }
}

.auth-modal-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    padding: 20px 28px 0;
    border-bottom: 2px solid var(--border);
}

/* auth-modal-header 内の modal-close-btn 位置調整 */
.auth-modal-header .modal-close-btn {
    flex-shrink: 0;
    margin-left: 8px;
    margin-bottom: 6px;
}

.auth-modal-body {
    overflow-y: auto;
    flex: 1;
    padding: 20px 28px 28px;
}

.auth-tabs {
    display: flex;
    flex: 1;
    gap: 4px;
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.auth-tab-btn {
    background: none;
    border: none;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-sub);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.auth-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.auth-input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    background: var(--bg-main);
    color: var(--text-main);
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
}

.auth-submit-btn {
    width: 100%;
    margin-top: 4px;
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.pw-checklist {
    list-style: none;
    padding: 0;
    margin: 6px 0 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pw-check-item {
    font-size: 0.78rem;
    color: var(--text-sub);
    padding-left: 18px;
    position: relative;
    transition: color 0.15s;
}

.pw-check-item::before {
    content: '○';
    position: absolute;
    left: 0;
    font-size: 0.7rem;
    line-height: 1.4;
}

.pw-check-item.met {
    color: #22c55e;
}

.pw-check-item.met::before {
    content: '✓';
    font-weight: 700;
}

.auth-terms-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.83rem;
    color: var(--text-sub);
    margin: 12px 0 4px;
    line-height: 1.5;
    cursor: pointer;
}

.auth-terms-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

.auth-terms-label a {
    color: var(--accent);
    text-decoration: none;
}

.auth-terms-label a:hover {
    text-decoration: underline;
}

.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 12px;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-main);
}

.auth-google-btn:hover {
    background: #f8fafc;
}

.auth-link-text {
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-sub);
    margin-top: 12px;
}

.auth-oauth-notice {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-sub);
    margin: 8px 0 0;
    line-height: 1.5;
}

.auth-oauth-notice a {
    color: var(--text-sub);
    text-decoration: underline;
}

.auth-oauth-notice a:hover {
    color: var(--accent);
}

.auth-link-text a {
    color: var(--accent);
}

.auth-error-msg {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.auth-success-msg {
    background: #d1fae5;
    color: #065f46;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

/* プランカード */
.plan-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}

.plan-card-premium {
    border-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb, #fefce8);
}

.plan-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.plan-card-header h4 {
    margin: 0;
    font-size: 1rem;
    flex: 1;
}

.plan-price {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
}

.plan-price small {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-sub);
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 14px 0;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-main);
    margin-bottom: 6px;
}

.plan-features .material-symbols-outlined {
    font-size: 16px !important;
    color: #10b981;
}

.plan-card .btn {
    width: 100%;
}

/* フッターリンク */
.footer-link {
    color: var(--text-sub);
    text-decoration: none;
}

.footer-link:hover {
    color: var(--text-main);
}

.footer-sep {
    color: var(--text-main);
    margin: 0 6px;
}

.lang-switch-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

@media (max-width: 480px) {
    .welcome-footer p {
        line-height: 1.8;
    }

    .footer-sep {
        margin: 0 3px;
    }
}

/* ヘッダーテーマボタン（非ログイン時表示） */
.header-lang-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-sub);
    padding: 3px 8px;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: 0.02em;
    line-height: 1.4;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.header-lang-btn:hover {
    color: var(--text-main);
    border-color: var(--text-main);
    background: var(--bg-card);
}

.header-theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-sub);
    padding: 6px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
    margin-right: 4px;
}

.header-theme-btn:hover {
    color: var(--text-main);
    background: var(--bg-card);
}

/* ログイン中はドロップダウン内にテーマボタンがあるので非表示 */
body.user-logged-in .header-theme-btn {
    display: none;
}

/* =========================================
   ダークテーマ
   - 自動: prefers-color-scheme: dark かつ html.light でない
   - 手動: html.dark クラス付与
   ========================================= */

/* 自動ダーク（html.light でなければOS設定に従う） */
@media (prefers-color-scheme: dark) {
    html:not(.light) {
        color-scheme: dark;
    }

    html:not(.light) .header-logo,
    html:not(.light) .welcome-logo {
        filter: brightness(0) invert(1);
    }
}

/* 手動ダーク */
html.dark {
    color-scheme: dark;
}

html.dark .header-logo,
html.dark .welcome-logo {
    filter: brightness(0) invert(1);
}

/* --- 共通ダーク変数（mixin代わりに2セレクタ） --- */
@media (prefers-color-scheme: dark) {
    html:not(.light) {
        --primary: #e0e0e0;
        --primary-hover: #f0f0f0;
        --accent: #60a5fa;
        --accent-hover: #3b82f6;
        --bg-body: #141414;
        --bg-sidebar: #1e1e1e;
        --bg-card: #2a2a2a;
        --bg-main: #1e1e1e;
        --bg-accent-tint: #1a2744;
        --color-danger: #f87171;
        --text-main: #e0e0e0;
        --text-sub: #999999;
        --text-muted: #666666;
        --border: #404040;
        --border-light: #333333;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
}

html.dark {
    --primary: #e0e0e0;
    --primary-hover: #f0f0f0;
    --accent: #60a5fa;
    --accent-hover: #3b82f6;
    --bg-body: #141414;
    --bg-sidebar: #1e1e1e;
    --bg-card: #2a2a2a;
    --bg-main: #1e1e1e;
    --bg-accent-tint: #1a2744;
    --color-danger: #f87171;
    --text-main: #e0e0e0;
    --text-sub: #999999;
    --text-muted: #666666;
    --border: #404040;
    --border-light: #333333;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- ダーク用セレクタオーバーライド --- */
/* 2つの条件で同じルールを適用:
   1) @media dark + html:not(.light)  = 自動モード
   2) html.dark                       = 手動ダーク
   以下、.dark-active を placeholder として各セレクタを列挙 */

@media (prefers-color-scheme: dark) {
    html:not(.light) .header-export-remaining {
        background: #2a2a2a;
        color: #cccccc;
    }

    html:not(.light) .header-export-btn:disabled {
        opacity: 0.5;
    }

    html:not(.light) .reset-usage-btn {
        border-color: #4a4a4a;
        color: #999999;
    }

    html:not(.light) .reset-usage-btn:hover {
        background: #2a2a2a;
        color: #e0e0e0;
    }

    html:not(.light) .badge-free {
        background: #1e1e1e;
        color: #9ca3af;
        border-color: #374151;
    }

    html:not(.light) .badge-light {
        background: linear-gradient(135deg, #172554, #1e3a5f);
        color: #93c5fd;
    }

    html:not(.light) .badge-premium {
        background: linear-gradient(135deg, #451a03, #78350f);
        color: #fcd34d;
        box-shadow: 0 1px 3px rgba(251, 191, 36, 0.15);
    }

    html:not(.light) .upload-dropzone {
        border-color: #4a4a4a;
        background-color: #1e1e1e;
    }

    html:not(.light) .upload-dropzone:hover,
    html:not(.light) .upload-dropzone.dragover {
        background-color: #1a2744;
    }

    html:not(.light) .logo-dropzone:hover {
        background: #1a2744;
    }

    html:not(.light) .pagination-box {
        background: #1e1e1e;
    }

    html:not(.light) .page-nav-btn:hover {
        background: #2a2a2a;
    }


    html:not(.light) .main-content {
        background: #141414;
    }

    html:not(.light) .sidebar {
        border-left-color: #333333;
    }

    html:not(.light) .sidebar-content::-webkit-scrollbar-thumb {
        background: #4a4a4a;
    }

    html:not(.light) .control-group {
        background: #1e1e1e;
        border-color: #404040;
    }

    html:not(.light) .accordion-header {
        background: #252525;
    }

    html:not(.light) .accordion-header:hover {
        background: #2a2a2a;
    }

    html:not(.light) .unit-toggle {
        border-color: #404040;
    }

    html:not(.light) .unit-toggle-item {
        color: #888;
    }

    html:not(.light) select {
        background: #1e1e1e;
        border-color: #404040;
        color: #e0e0e0;
    }

    html:not(.light) .custom-textarea,
    html:not(.light) .custom-input,
    html:not(.light) .aspect-custom-wrap input {
        background: #1e1e1e;
        border-color: #404040;
        color: #e0e0e0;
    }

    html:not(.light) .auth-input {
        background: #1e1e1e;
        border-color: #404040;
        color: #e0e0e0;
    }

    html:not(.light) input[type="range"] {
        background: #4a4a4a;
    }

    html:not(.light) .slider-btn {
        background: #2a2a2a;
        border-color: #404040;
        color: #999999;
    }

    html:not(.light) .slider-btn:hover {
        background: #333333;
        border-color: #666666;
        color: #e0e0e0;
    }

    html:not(.light) .radio-card:has(input[type="radio"]:checked),
    html:not(.light) .font-card:has(input[type="radio"]:checked),
    html:not(.light) .info-card:has(input[type="checkbox"]:checked) {
        background: #1a2744;
    }

    html:not(.light) .val-input-wrap {
        background: #1a2744;
        border-color: #1e40af;
    }

    html:not(.light) .action-btn:hover {
        background: #1a2744;
    }

    html:not(.light) .btn-outline:hover:not(:disabled) {
        background: #1a2744;
    }


    html:not(.light) input[type="range"]::-webkit-slider-thumb {
        background: #cccccc;
        border-color: var(--accent);
    }

    html:not(.light) input[type="range"]::-moz-range-thumb {
        background: #cccccc;
        border-color: var(--accent);
    }

    html:not(.light) input[type="color"] {
        background: #2a2a2a;
        border-color: #404040;
    }

    html:not(.light) .override-accordion {
        background: #2a2a2a;
        border-color: #404040;
    }

    html:not(.light) .btn:disabled {
        background: #4a4a4a;
    }

    html:not(.light) .template-search-input {
        background: #1e1e1e;
    }

    html:not(.light) .template-apply-btn {
        background: #e0e0e0 !important;
        color: #141414 !important;
        border-color: #e0e0e0 !important;
    }

    html:not(.light) .template-apply-btn:hover {
        background: #cccccc !important;
        border-color: #cccccc !important;
    }

    html:not(.light) .template-suggestions {
        background: #1e1e1e;
    }

    html:not(.light) .template-suggestion-thumb,
    html:not(.light) .template-suggestion-thumb-empty {
        background: #2a2a2a;
    }

    html:not(.light) .template-suggestion-item:hover,
    html:not(.light) .template-suggestion-item.selected {
        background: #1a2744;
    }

    html:not(.light) .template-modal-box {
        background: #1e1e1e;
    }

    html:not(.light) .template-manage-header:hover {
        background: #2a2a2a;
    }

    html:not(.light) .template-manage-thumb,
    html:not(.light) .template-manage-thumb-empty {
        background: #2a2a2a;
    }

    html:not(.light) .template-action-btn {
        background: #1e1e1e;
    }

    html:not(.light) .template-action-btn:hover {
        background: #1a2744;
    }

    html:not(.light) .template-delete-btn:hover {
        background: #451a1a;
    }

    html:not(.light) .template-manage-accordion {
        background: #1e1e1e;
    }

    html:not(.light) .template-toast {
        background: #e0e0e0;
        color: #141414;
    }

    html:not(.light) .template-load-thumb-wrap {
        background: #1a1a1a;
        border-color: #333;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    }

    html:not(.light) .template-load-item:hover .template-load-thumb-wrap {
        box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
    }

    html:not(.light) .template-load-thumb-empty {
        background: #2a2a2a;
    }

    html:not(.light) .template-load-name {
        color: #cccccc;
    }

    html:not(.light) .template-load-list-item {
        border-color: #333;
    }

    html:not(.light) .template-load-list-item:hover {
        border-color: var(--accent);
    }

    html:not(.light) .template-load-list-thumb-wrap {
        background: #1a1a1a;
    }

    html:not(.light) .template-load-list-thumb-empty {
        background: #2a2a2a;
    }

    html:not(.light) .template-load-list-table th {
        color: #888;
        border-color: #2a2a2a;
    }

    html:not(.light) .tl-tag {
        background: #1a1a1a;
        border-color: #333;
        color: #999;
    }

    html:not(.light) .bg-image-upload-area {
        border-color: #4a4a4a;
    }

    html:not(.light) .bg-image-upload-label {
        color: #999999;
    }

    html:not(.light) .modal-close-btn {
        background: #2a2a2a;
        border-color: #404040;
    }

    html:not(.light) .modal-close-btn:hover {
        background: #404040;
    }

    html:not(.light) .grid-item-wrapper {
        background: #2a2a2a;
    }

    html:not(.light) .ad-slot-sidebar {
        background: transparent;
    }

    html:not(.light) .ad-modal-ad {
        background: #2a2a2a;
    }

    html:not(.light) .ad-modal-title {
        color: #4ade80;
    }

    html:not(.light) .plan-current-notice {
        background: #14532d;
        border-color: #166534;
        color: #86efac;
    }

    html:not(.light) .plan-current-notice .material-symbols-outlined {
        color: #4ade80;
    }

    html:not(.light) .plan-current-premium {
        background: #422006;
        border-color: #713f12;
        color: #fde68a;
    }

    html:not(.light) .plan-current-premium .material-symbols-outlined {
        color: #fbbf24;
    }

    html:not(.light) .auth-google-btn {
        background: #1e1e1e;
        border-color: #404040;
    }

    html:not(.light) .auth-google-btn:hover {
        background: #2a2a2a;
    }

    html:not(.light) .auth-error-msg {
        background: #451a1a;
        color: #fca5a5;
    }

    html:not(.light) .auth-success-msg {
        background: #14532d;
        color: #86efac;
    }

    html:not(.light) .plan-card-premium {
        background: linear-gradient(135deg, #422006, #451a03) !important;
        border-color: #92400e !important;
    }

    html:not(.light) #close-preview-modal-btn {
        background: rgba(255, 255, 255, 0.15);
    }
}

/* 手動ダーク: 同じルール */
html.dark .header-export-remaining {
    background: #2a2a2a;
    color: #cccccc;
}

html.dark .header-export-btn:disabled {
    opacity: 0.5;
}

html.dark .reset-usage-btn {
    border-color: #4a4a4a;
    color: #999999;
}

html.dark .reset-usage-btn:hover {
    background: #2a2a2a;
    color: #e0e0e0;
}

html.dark .badge-free {
    background: #1e1e1e;
    color: #9ca3af;
    border-color: #374151;
}

html.dark .badge-light {
    background: linear-gradient(135deg, #172554, #1e3a5f);
    color: #93c5fd;
}

html.dark .badge-premium {
    background: linear-gradient(135deg, #451a03, #78350f);
    color: #fcd34d;
    box-shadow: 0 1px 3px rgba(251, 191, 36, 0.15);
}

html.dark .upload-dropzone {
    border-color: #4a4a4a;
    background-color: #1e1e1e;
}

html.dark .upload-dropzone:hover,
html.dark .upload-dropzone.dragover {
    background-color: #1a2744;
}

html.dark .logo-dropzone:hover {
    background: #1a2744;
}

html.dark .pagination-box {
    background: #1e1e1e;
}

html.dark .page-nav-btn:hover {
    background: #2a2a2a;
}


html.dark .main-content {
    background: #141414;
}

html.dark .sidebar {
    border-left-color: #333333;
}

html.dark .sidebar-content::-webkit-scrollbar-thumb {
    background: #4a4a4a;
}

html.dark .control-group {
    background: #1e1e1e;
    border-color: #404040;
}

html.dark .accordion-header {
    background: #252525;
    border-bottom-color: #404040;
}

html.dark .accordion-header:hover {
    background: #2a2a2a;
}

html.dark .unit-toggle {
    border-color: #404040;
}

html.dark .unit-toggle-item {
    color: #888;
}

html.dark select {
    background: #1e1e1e;
    border-color: #404040;
    color: #e0e0e0;
}

html.dark .custom-textarea,
html.dark .custom-input,
html.dark .aspect-custom-wrap input {
    background: #1e1e1e;
    border-color: #404040;
    color: #e0e0e0;
}

html.dark .auth-input {
    background: #1e1e1e;
    border-color: #404040;
    color: #e0e0e0;
}

html.dark input[type="range"] {
    background: #4a4a4a;
}

html.dark .slider-btn {
    background: #2a2a2a;
    border-color: #404040;
    color: #999999;
}

html.dark .slider-btn:hover {
    background: #333333;
    border-color: #666666;
    color: #e0e0e0;
}

html.dark .radio-card:has(input[type="radio"]:checked),
html.dark .font-card:has(input[type="radio"]:checked),
html.dark .info-card:has(input[type="checkbox"]:checked) {
    background: #1a2744;
}

html.dark .val-input-wrap {
    background: #1a2744;
    border-color: #1e40af;
}

html.dark .action-btn:hover {
    background: #1a2744;
}

html.dark .btn-outline:hover:not(:disabled) {
    background: #1a2744;
}


html.dark input[type="range"]::-webkit-slider-thumb {
    background: #cccccc;
    border-color: var(--accent);
}

html.dark input[type="range"]::-moz-range-thumb {
    background: #cccccc;
    border-color: var(--accent);
}

html.dark input[type="color"] {
    background: #2a2a2a;
    border-color: #404040;
}

html.dark .override-accordion {
    background: #2a2a2a;
    border-color: #404040;
}

html.dark .btn:disabled {
    background: #4a4a4a;
}

html.dark .template-search-input {
    background: #1e1e1e;
}

html.dark .template-apply-btn {
    background: #e0e0e0 !important;
    color: #141414 !important;
    border-color: #e0e0e0 !important;
}

html.dark .template-apply-btn:hover {
    background: #cccccc !important;
    border-color: #cccccc !important;
}

html.dark .template-suggestions {
    background: #1e1e1e;
}

html.dark .template-suggestion-thumb,
html.dark .template-suggestion-thumb-empty {
    background: #2a2a2a;
}

html.dark .template-suggestion-item:hover,
html.dark .template-suggestion-item.selected {
    background: #1a2744;
}

html.dark .template-modal-box {
    background: #1e1e1e;
}

html.dark .template-manage-header:hover {
    background: #2a2a2a;
}

html.dark .template-manage-thumb,
html.dark .template-manage-thumb-empty {
    background: #2a2a2a;
}

html.dark .template-action-btn {
    background: #1e1e1e;
}

html.dark .template-action-btn:hover {
    background: #1a2744;
}

html.dark .template-delete-btn:hover {
    background: #451a1a;
}

html.dark .template-manage-accordion {
    background: #1e1e1e;
}

html.dark .template-toast {
    background: #e0e0e0;
    color: #141414;
}

html.dark .template-load-thumb-wrap {
    background: #1a1a1a;
    border-color: #333;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

html.dark .template-load-item:hover .template-load-thumb-wrap {
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.25);
}

html.dark .template-load-thumb-empty {
    background: #2a2a2a;
}

html.dark .template-load-name {
    color: #cccccc;
}

html.dark .bg-image-upload-area {
    border-color: #4a4a4a;
}

html.dark .bg-image-upload-label {
    color: #999999;
}

html.dark .modal-close-btn {
    background: #2a2a2a;
    border-color: #404040;
}

html.dark .modal-close-btn:hover {
    background: #404040;
}

html.dark .grid-item-wrapper {
    background: #2a2a2a;
}

html.dark .ad-slot-sidebar {
    background: transparent;
}

html.dark .ad-modal-ad {
    background: #2a2a2a;
}

html.dark .ad-modal-title {
    color: #4ade80;
}

html.dark .plan-current-notice {
    background: #14532d;
    border-color: #166534;
    color: #86efac;
}

html.dark .plan-current-notice .material-symbols-outlined {
    color: #4ade80;
}

html.dark .plan-current-premium {
    background: #422006;
    border-color: #713f12;
    color: #fde68a;
}

html.dark .plan-current-premium .material-symbols-outlined {
    color: #fbbf24;
}

html.dark .auth-google-btn {
    background: #1e1e1e;
    border-color: #404040;
}

html.dark .auth-google-btn:hover {
    background: #2a2a2a;
}

html.dark .auth-error-msg {
    background: #451a1a;
    color: #fca5a5;
}

html.dark .auth-success-msg {
    background: #14532d;
    color: #86efac;
}

html.dark .plan-card-premium {
    background: linear-gradient(135deg, #422006, #451a03) !important;
    border-color: #92400e !important;
}

html.dark #close-preview-modal-btn {
    background: rgba(255, 255, 255, 0.15);
}

/* --- スマホ対応（ダーク） --- */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    html:not(.light) .main-content {
        background: #141414 !important;
    }

    html:not(.light) .pagination-box {
        background: #1e1e1e !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2) !important;
    }

    html:not(.light) .sidebar {
        border-top-color: #333333 !important;
    }
}

@media (max-width: 768px) {
    html.dark .main-content {
        background: #141414 !important;
    }

    html.dark .pagination-box {
        background: #1e1e1e !important;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2) !important;
    }

    html.dark .sidebar {
        border-top-color: #333333 !important;
    }
}

/* =========================================
   テーマ選択モーダル
   ========================================= */
.theme-modal-box {
    background: var(--bg-sidebar);
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 380px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.theme-options {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    transition: border-color 0.2s, background 0.15s;
    flex: 1;
}

.theme-option:hover {
    background: var(--bg-card);
}

.theme-option.active {
    border-color: var(--accent);
    background: var(--bg-card);
}

.theme-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
}

/* --- テーマプレビュー（macOS風ミニカード） --- */
.theme-preview {
    width: 90px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border);
}

/* 自動: 左半分ダーク、右半分ライト */
.theme-preview-auto {
    display: flex;
}

.theme-preview-auto .theme-preview-dark {
    flex: 1;
    background: #1e293b;
    padding: 6px 4px 0 6px;
    border-radius: 8px 0 0 8px;
}

.theme-preview-auto .theme-preview-light {
    flex: 1;
    background: #f1f5f9;
    padding: 6px 6px 0 4px;
    border-radius: 0 8px 8px 0;
}

.theme-preview-auto .theme-preview-dark .theme-bar {
    background: #475569;
}

.theme-preview-auto .theme-preview-light .theme-bar {
    background: #cbd5e1;
}

/* ライト単体 */
.theme-preview-light-only {
    background: #f1f5f9;
    padding: 6px;
}

.theme-preview-light-only .theme-bar {
    background: #cbd5e1;
}

.theme-preview-light-only .theme-dot.red {
    background: #ef4444;
}

.theme-preview-light-only .theme-dot.yellow {
    background: #f59e0b;
}

.theme-preview-light-only .theme-dot.green {
    background: #22c55e;
}

/* ダーク単体 */
.theme-preview-dark-only {
    background: #1e293b;
    padding: 6px;
}

.theme-preview-dark-only .theme-bar {
    background: #475569;
}

.theme-preview-dark-only .theme-dot.red {
    background: #ef4444;
}

.theme-preview-dark-only .theme-dot.yellow {
    background: #f59e0b;
}

.theme-preview-dark-only .theme-dot.green {
    background: #22c55e;
}

/* ドット（信号機） */
.theme-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 2px;
}

.theme-dot.red {
    background: #ef4444;
}

.theme-dot.yellow {
    background: #f59e0b;
}

.theme-dot.green {
    background: #22c55e;
}

/* バー（タイトルバー風） */
.theme-bar {
    height: 8px;
    border-radius: 3px;
    margin-top: 6px;
    width: 70%;
}

/* 自動プレビュー内のドット（サイズ小さめ） */
.theme-preview-auto .theme-dot {
    width: 4px;
    height: 4px;
    margin-right: 1px;
}

.theme-preview-auto .theme-bar {
    height: 6px;
    margin-top: 5px;
}