@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Symbols+Rounded');

:root {
    --primary: #ff69b4;
    --expense: #6a9bd8;
    --bg-color: #ffffff;
    --text-color: #525151;
    --radius: 16px;
}

html {
    overscroll-behavior-y: none;
}

body {
    margin: 0;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: #f9f9f9;
    color: var(--text-color);
    letter-spacing: 0.03em;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

.app-container {
    max-width: 500px;
    margin: 0 auto;
    background: var(--app-bg-image, white);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    box-shadow: 0 0 30px rgba(0,0,0,0.03);
    position: relative;
    z-index: 1;
}

/* Splash Screen */
/* Global Loader (FOUC防止 & ローディング) */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color, white);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease-out, visibility 0.5s;
}
.global-loader.fadeout {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-icon {
    width: 280px;
    height: 70px;
    background-color: var(--primary, #ff69b4); /* 推し色を適用 */
    -webkit-mask-image: url('logo.svg');
    mask-image: url('logo.svg');
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    /* ふわふわ浮くアニメーション */
    animation: float-loader 2.5s ease-in-out infinite;
}

@keyframes float-loader {
    0% { transform: translateY(0px); opacity: 1; }
    50% { transform: translateY(-15px); opacity: 0.85; }
    100% { transform: translateY(0px); opacity: 1; }
}

@keyframes fade-up {
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.app-header {
    background: var(--primary);
    color: var(--text-on-primary);
    padding: 30px 20px 20px;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.oshi-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: white;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.oshi-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Common Components */
.card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    margin: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
}

input, select, textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fafafa;
    font-size: 1rem;
    font-family: inherit;
    box-sizing: border-box;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
}

button.submit-btn {
    width: 100%;
    padding: 16px;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    cursor: pointer;
    margin-top: 10px;
    transition: background 0.3s;
}

button.submit-btn:active {
    transform: scale(0.98);
}

.file-upload-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #f0f0f0;
    color: #666;
    border-radius: 30px;
    font-size: 0.9rem;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    justify-content: center;
    border: 1px dashed #ccc;
    margin-top: 5px;
}

.file-upload-label.active {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff0f5;
}

input[type="file"] {
    display: none;
}

.yt-preview {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: 12px;
    margin-top: 10px;
    display: none;
    object-fit: cover;
}

/* Gauge */
.gauge-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 10px auto;
}

.gauge-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    overflow: visible;
}

.gauge-bg {
    fill: none;
    stroke: #eee;
    stroke-width: 24;
}

.gauge-bar {
    fill: none;
    stroke-width: 24;
    stroke-linecap: round;
    stroke-dasharray: 358;
    stroke-dashoffset: 358;
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
}

.gauge-percent {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.gauge-label {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
}

/* Switch UI */
.type-switch {
    display: flex;
    background: #f0f0f0;
    border-radius: 50px;
    padding: 5px;
    margin-bottom: 20px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.type-opt {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    border-radius: 40px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaa;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.type-opt.active {
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-1px);
}

.type-opt.active[data-type="income"] {
    color: var(--primary);
}

.type-opt.active[data-type="expense"] {
    color: var(--expense);
}

/* Calendar & Days */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
    padding: 0 15px;
}

.cal-day {
    aspect-ratio: 0.75;
    border-radius: 8px;
    background: #f7f7f7;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    font-size: 0.8rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    padding-top: 4px;
    border: 1px solid transparent;
}

.cal-day.today {
    border-color: var(--primary);
    background: #fff5f9;
    color: var(--primary);
    font-weight: bold;
}

.cal-thumb {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    z-index: 1;
}

.cal-day span {
    position: relative;
    z-index: 2;
}

.daily-total {
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 0.6rem;
    background: rgba(255,255,255,0.9);
    padding: 1px 3px;
    border-radius: 4px;
    color: #333;
    font-weight: bold;
    z-index: 3;
    pointer-events: none;
}

.dt-plus {
    color: var(--primary);
}

.dt-minus {
    color: var(--expense);
}

/* Detail List */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.add-circle-btn {
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    padding: 0;
}

.add-circle-btn .material-symbols-rounded {
    font-size: 20px;
}

.log-item {
    display: block;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px dashed #eee;
}

.log-thumb {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: #eee;
    object-fit: cover;
    flex-shrink: 0;
}

.log-info {
    flex: 1;
    min-width: 0;
}

.log-title {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.log-meta {
    font-size: 0.75rem;
    color: #888;
    display: flex;
    gap: 5px;
}

.type-badge {
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.65rem;
    color: white;
}

.bg-inc {
    background: var(--primary);
}

.bg-exp {
    background: var(--expense);
}

.log-price {
    font-weight: bold;
    font-size: 0.9rem;
    margin-top: 2px;
}

.txt-inc {
    color: var(--primary);
}

.txt-exp {
    color: var(--expense);
}

/* Report & Month Selector */
.month-selector {
    display: flex;
    gap: 10px;
    padding: 10px 20px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
}

.month-selector::-webkit-scrollbar {
    display: none;
}

.month-chip {
    padding: 8px 16px;
    border-radius: 20px;
    background: #eee;
    color: #888;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

.month-chip.active {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.report-month-box {
    background: white;
    border-radius: 16px;
    margin: 15px 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    overflow: hidden;
    border: 1px solid #eee;
}

.report-content {
    padding: 15px;
}

.report-balance-box {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: white;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 15px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    border: 1px solid #f9f9f9;
}

.rb-item {
    padding: 0 5px;
}

.rb-label {
    font-size: 0.7rem;
    color: #aaa;
    margin-bottom: 2px;
}

.rb-val {
    font-weight: bold;
    font-size: 0.9rem;
}

.report-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.report-thumb {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-icon-btn {
    background: #f8f8f8;
    border: none;
    border-radius: 8px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modals */
dialog {
    border: none;
    outline: none;
    background: #fff;
    border-radius: 20px;
    padding: 20px;
    width: 85%;
    max-width: 350px;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    box-sizing: border-box;
    overflow-x: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    z-index: 10000;
}

dialog::backdrop {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid #eee;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 9999;
    display: flex;
    justify-content: space-around;
    padding-top: 8px;
}

.nav-item {
    flex: 1;
    text-align: center;
    color: #aaa;
    font-size: 0.65rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 8px;
}

.nav-icon-circle {
    width: 54px;
    height: 30px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    transition: background-color 0.3s;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: block;
}

.nav-icon path, 
.nav-icon rect {
    fill: #aaa;
    transition: fill 0.3s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: bold;
}

.nav-item.active .nav-icon-circle {
    background-color: var(--primary);
}

.nav-item.active .nav-icon path,
.nav-item.active .nav-icon rect {
    fill: var(--text-on-primary);
}

/* Tab Contents */
.tab-content {
    display: none;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    padding-bottom: 120px;
}

.tab-content.active {
    display: block;
}

/* 設定のサブページ表示時に下の余白をなくす */
.tab-content#tab-settings.sub-page-active {
    padding-bottom: 0 !important;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Category Edit */
.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.category-box {
    aspect-ratio: 1;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    padding: 5px;
    min-width: 0;
    -webkit-user-select: none; /* Safari, Chrome */
    -moz-user-select: none;    /* Firefox */
    -ms-user-select: none;     /* IE 10+ */
    user-select: none;         /* Standard */
    touch-action: pan-y;       /* 縦スクロールのみ許可 */
    -webkit-touch-callout: none; /* 長押しメニューを無効化 */
}

.cat-icon {
    font-size: 28px;
    margin-bottom: 5px;
    color: var(--primary);
}

.category-box.empty {
    border: 1px dashed #ccc;
    background: #fdfdfd;
    color: #ccc;
}

.category-box.dragging {
    opacity: 0.5;
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    background: #fff;
    cursor: grabbing;
    z-index: 10;
    position: relative;
}

.category-box.drag-over-before {
    border-top: 2px solid var(--primary);
}

.category-box.drag-over-after {
    border-bottom: 2px solid var(--primary);
}


.icon-selector {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 15px;
    background: #f9f9f9;
    padding: 10px;
    border-radius: 12px;
}

.icon-option {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    background: white;
    color: #888;
}

.icon-option.selected {
    border-color: var(--primary);
    color: var(--primary);
    background: #fff0f5;
}

/* Sub Tabs (Home) */
.sub-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 0px 20px;
}

.sub-tab-item {
    padding: 8px 16px;
    border-radius: 20px;
    background: #eee;
    color: #888;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.sub-tab-item.active {
    background: var(--primary);
    color: var(--text-on-primary);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* FAB */
.fab-btn {
    position: fixed;
    bottom: 85px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: transform 0.2s;
}

.fab-btn:active {
    transform: scale(0.9);
}

.fab-btn span {
    font-size: 32px;
}

/* Unwatched List Item */
.unwatched-item {
    background: white;
    border-radius: 16px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid #eee;
    position: relative;
}

.unwatched-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: #ff4757;
    color: white;
    font-size: 0.65rem;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: bold;
    z-index: 2;
}

.video-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.action-btn {
    flex: 1;
    padding: 8px;
    border-radius: 8px;
    border: none;
    font-size: 0.85rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.btn-play {
    background: #f0f0f0;
    color: #444;
}

.btn-record {
    background: var(--primary);
    color: white;
}

/* Timestamp Link */
.ts-link {
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
    font-weight: bold;
}

/* Search Box */
.search-box {
    display: flex;
    align-items: stretch;
    border: 1px solid #eee;
    border-radius: 12px;
    background: #fafafa;
    overflow: hidden;
    margin-top: 15px;
}

.search-box input#yt-search-input {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 0;
    margin: 0;
    box-shadow: none;
    -webkit-appearance: none;
}

.search-box input#yt-search-input:focus {
    background: white;
    outline: none;
}

.search-btn {
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    padding: 0 15px;
    cursor: pointer;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.search-btn:hover {
    opacity: 0.9;
}

.search-btn .material-symbols-rounded {
    font-size: 24px;
    font-variation-settings: 'wght' 600;
}

/* Latest Videos */
.latest-scroll-area {
    display: flex;
    align-items: flex-start;
    overflow-x: auto;
    padding: 0 20px 30px;
    gap: 15px;
    scrollbar-width: none;
}

.latest-scroll-area::-webkit-scrollbar {
    display: none;
}

.video-item {
    flex: 0 0 min(280px, calc(100vw - 80px));
    min-width: min(280px, calc(100vw - 80px));
    max-width: min(280px, calc(100vw - 80px));
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
}

.video-item.live {
    flex-basis: min(320px, calc(100vw - 80px));
    min-width: min(320px, calc(100vw - 80px));
    max-width: min(320px, calc(100vw - 80px));
}

.video-thumb {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #111;
}

.video-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.video-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.45;
    color: inherit;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.video-meta {
    display: block;
    font-size: 0.85rem;
    line-height: 1.4;
    color: #666;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.latest-video-card {
    min-width: 140px;
    width: 140px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    border: 1px solid #eee;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s;
}

.latest-video-card:active {
    transform: scale(0.95);
}

.latest-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: #000;
}

.latest-info {
    padding: 8px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.latest-title {
    font-size: 0.75rem;
    font-weight: bold;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    margin-bottom: 5px;
}

.latest-date {
    font-size: 0.65rem;
    color: #999;
}

@media (max-width: 480px) {
    .latest-scroll-area {
        gap: 12px;
        padding: 0 20px 25px;
    }

    .video-item,
    .video-item.live {
        flex-basis: calc(100vw - 80px);
        min-width: calc(100vw - 80px);
        max-width: calc(100vw - 80px);
    }
}

/* Paste Button */
.paste-btn {
    padding: 0 15px;
    border-radius: 12px;
    border: 1px solid #eee;
    background: #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.paste-btn:active {
    background: #e0e0e0;
}

.paste-btn .material-symbols-rounded {
    color: inherit;
}

/* Profile Switcher */
.header-switch-btn {
    margin-left: auto;
    background: white;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    /* backdrop-filter: blur(4px); */
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.header-switch-btn:active {
    transform: scale(0.92);
    background: #f0f0f0;
}

.header-switch-btn .material-symbols-rounded {
    font-size: 26px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.profile-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-card {
    display: flex;
    align-items: center;
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-card:active {
    transform: scale(0.98);
    background: #eee;
}

.profile-card.active {
    border: 2px solid var(--primary);
    background: #fff0f5;
}

.profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: #ddd;
    margin-right: 12px;
    border: 1px solid rgba(0,0,0,0.1);
}

.profile-name {
    font-weight: bold;
    font-size: 0.95rem;
    flex: 1;
}

.profile-check {
    color: var(--primary);
    font-variation-settings: 'FILL' 1;
    display: none;
}

.profile-card.active .profile-check {
    display: block;
}

.add-profile-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    padding: 12px;
    border: 1px dashed #ccc;
    background: #fafafa;
    color: #888;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.9rem;
    margin-top: 10px;
}

/* Search Result Item */
.search-result-card {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-card:active {
    background: #f0f0f0;
}

.search-result-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 10px;
    background: #ddd;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-id {
    font-size: 0.7rem;
    color: #aaa;
}

/* Custom SVG Icons */
svg.nav-icon {
    width: 24px;
    height: 24px;
    transition: all 0.3s;
    display: block;
    margin: 0 auto 4px auto;
}

svg.nav-icon .base,
svg.nav-icon .variable-color {
    fill: #aaa;
}

.nav-item.active svg.nav-icon .base {
    fill: var(--text-color);
    opacity: 0.4;
}

.nav-item.active svg.nav-icon .variable-color {
    fill: var(--primary) !important;
}

.primary-cancel-btn {
    background-color: white !important;
    color: var(--primary) !important;
    border: 2px solid var(--primary) !important;
    transition: all 0.2s;
}

.primary-cancel-btn:active {
    background-color: var(--primary) !important;
    color: white !important;
}

/* モバイルキーボード対策 */
@media (max-height: 600px) {
    dialog {
        max-height: 85vh;
        top: 20px;
        bottom: auto;
        transform: none;
        overflow-y: scroll;
        padding-bottom: 100px;
    }

    dialog input:focus,
    dialog textarea:focus,
    dialog select:focus {
        scroll-margin-top: 60px;
    }
}

/* --- カスタムSVGアイコン用スタイル --- */
.custom-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.custom-icon-wrapper svg {
    width: 100%;
    height: 100%;
    display: block;
}

.custom-icon-wrapper svg #color,
.custom-icon-wrapper svg #color path,
.custom-icon-wrapper svg #color polygon,
.custom-icon-wrapper svg #color rect,
.custom-icon-wrapper svg #color circle {
    fill: var(--primary) !important;
}

.custom-icon-wrapper.cat-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 5px;
}

.icon-option .custom-icon-wrapper {
    width: 24px;
    height: 24px;
}

/* --- Settings List UI --- */
.settings-list-group {
    background: white;
    border-radius: 16px;
    margin: 0 20px 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.03);
    border: 1px solid #eee;
    overflow: hidden;
}

.settings-list-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    transition: background 0.2s;
}

.settings-list-item:active {
    background: #f9f9f9;
}

.settings-list-item:last-child {
    border-bottom: none;
}

.settings-icon-wrap {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
}

.settings-icon-wrap .material-symbols-rounded {
    font-size: 20px;
}

.settings-list-text {
    flex: 1;
    font-size: 0.95rem;
    font-weight: bold;
    color: #444;
}

.settings-list-item .chevron {
    color: #ccc;
    font-size: 20px;
}

/* --- Settings Sub Page --- */
.settings-sub-page {
    animation: slideInRight 0.3s forwards;
    padding-bottom: 80px;
}

.sub-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sub-page-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #333;
}

.sub-page-header .back-btn {
    color: var(--primary);
    cursor: pointer;
    font-size: 24px;
    padding: 5px;
    margin-left: -5px;
}

@keyframes slideInRight {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* --- Premium Invite Box --- */
.premium-invite-box {
    margin: 0 20px 40px;
    background: linear-gradient(135deg, #fff 0%, #fff5f9 100%);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 20px;
    position: relative;
    box-shadow: 0 10px 25px rgba(255, 105, 180, 0.15);
    overflow: hidden;
    transition: transform 0.2s;
}

.premium-invite-box:active {
    transform: scale(0.98);
}

.premium-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 4px 12px;
    border-bottom-left-radius: 12px;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.premium-invite-box h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--primary);
    padding-top: 5px;
}

/* Type Switch Icons */
.type-opt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.type-opt svg.type-icon {
    width: 16px;
    height: 16px;
    fill: #aaa;
    transition: fill 0.3s;
}

.type-opt.active[data-type="income"] svg.type-icon {
    fill: var(--primary);
}

.type-opt.active[data-type="expense"] svg.type-icon {
    fill: var(--expense);
}

/* Report Tabs Icons */
.type-opt.active[data-type="album"] svg.type-icon,
.type-opt.active[data-type="graph"] svg.type-icon {
    fill: var(--primary);
}

.type-opt svg.type-icon path,
.type-opt svg.type-icon circle,
.type-opt svg.type-icon rect {
    fill: inherit;
}

/* --- 推し活レシート用デザイン --- */
.oshi-receipt {
    background: #fff;
    padding: 30px 25px;
    color: #555;
    font-family: 'M PLUS Rounded 1c', sans-serif;
    border: 1px solid #eee;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

.receipt-header {
    text-align: center;
    border-bottom: 2px dashed #ccc;
    padding-bottom: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.receipt-header p { margin: 5px 0; font-size: 0.85rem; }
.receipt-header h3 { margin: 10px 0 0; font-size: 1.1rem; border-bottom: 1px solid currentColor; display: inline-block; padding-bottom: 2px; }

.receipt-body .receipt-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 1.05rem;
    font-weight: bold;
}
.receipt-line { border: none; border-top: 2px dashed #ccc; margin: 15px 0; }

.receipt-footer {
    text-align: center;
    margin-top: 30px;
}

.receipt-barcode-wrap {
    margin-top: 15px;
    text-align: center;
}

.receipt-barcode-svg {
    width: 200px;
    height: 40px;
}

.receipt-barcode {
    display: none;
}

/* --- Premium Plan Slider --- */
.plan-slider-container {
    position: relative;
    display: flex;
    align-items: center;
}

.plan-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    gap: 15px;
    padding: 10px 0 20px;
}

.plan-slider::-webkit-scrollbar {
    display: none;
}

.plan-card {
    min-width: 100%;
    scroll-snap-align: center;
    background: white;
    border-radius: 20px;
    padding: 25px 20px;
    box-sizing: border-box;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    border: 1px solid #eee;
}

.plan-card.featured {
    border: 3px solid var(--primary);
    box-shadow: 0 8px 25px rgba(255, 105, 180, 0.2);
}

.plan-badge {
    display: inline-block;
    padding: 4px 12px;
    background: #f0f0f0;
    border-radius: 50px;
    font-size: 0.65rem;
    font-weight: bold;
    color: #888;
    margin-bottom: 10px;
}

.plan-card.featured .plan-badge {
    background: var(--primary);
    color: white;
}

.plan-card h3 { margin: 0 0 5px; font-size: 1.2rem; color: #333; }
.plan-desc { font-size: 0.8rem; color: #666; margin-bottom: 10px; line-height: 1.4; }

.plan-price { font-size: 1.8rem; font-weight: bold; color: var(--primary); margin-bottom: 20px; }
.plan-price span { font-size: 0.85rem; color: #888; }

.plan-card ul { text-align: left; margin: 0 0 25px; padding: 0; list-style: none; }
.plan-card li { font-size: 0.85rem; color: #555; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.plan-card li::before { content: "check_circle"; font-family: 'Material Symbols Rounded'; color: var(--primary); font-size: 18px; }

.plan-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.3);
}

.slider-arrow {
    position: absolute;
    width: 40px;
    height: 40px;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    border-radius: 50%;
    display: none; 
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

@media (min-width: 768px) { .slider-arrow { display: flex; } }
.slider-arrow.left { left: -50px; }
.slider-arrow.right { right: -50px; }

.slider-dots { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.dot { width: 8px; height: 8px; background: #ddd; border-radius: 50%; transition: 0.3s; }
.dot.active { background: var(--primary); width: 20px; border-radius: 10px; }

.current-plan-card {
    margin: 0 0 25px 0;
    padding: 20px;
    background: #fafafa;
    border-radius: 16px;
    border: none;
    box-shadow: none;
}

.current-plan-card h4 {
    margin: 0 0 15px;
    color: #555;
    font-size: 0.95rem;
    font-weight: bold;
}

.free-plan-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.free-plan-list li {
    font-size: 0.85rem;
    color: #777;
    line-height: 1.6;
    display: flex;
    align-items: center;
    gap: 10px;
}

.free-plan-list li::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.upgrade-title {
    text-align: center;
    color: var(--primary);
    margin: 0 0 20px;
    font-size: 1.1rem;
    font-weight: bold;
}

/* --- プレミアプラン：グラデーションテーマ対応 --- */
:root {
    --primary-bg: var(--primary); 
}

.submit-btn,
.fab-btn,
.add-profile-btn,
.type-opt.active,
.slider-arrow,
.plan-card.featured .plan-badge,
.paste-btn {
    background: var(--primary-bg) !important;
    color: var(--text-on-primary) !important; 
}

.type-opt.active[data-type="album"] svg.type-icon,
.type-opt.active[data-type="graph"] svg.type-icon,
.type-opt.active svg.type-icon {
    fill: var(--text-on-primary) !important;
}

/* --- グラフ用スライダー --- */
.graph-slider-container { width: 100%; }
.graph-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    gap: 15px;
    padding-bottom: 5px;
    align-items: flex-start !important;
    overflow-y: hidden !important;
}
.graph-slider::-webkit-scrollbar { display: none; }
.graph-slide {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
}

/* --- 背景画像用：グラスモーフィズム（すりガラスUI） --- */
body.has-glass-ui .summary-card,
body.has-glass-ui .calendar-container,
body.has-glass-ui .report-month-box,
body.has-glass-ui .profile-card,
body.has-glass-ui .settings-list-group,
body.has-glass-ui .log-item,
body.has-glass-ui .unwatched-item {
    background: rgba(255, 255, 255, 0.6) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
}

body.has-glass-ui .cal-day {
    background: transparent !important; 
    border-color: rgba(255, 255, 255, 0.5) !important;
}

body.has-glass-ui .cal-day.today {
    background: rgba(255, 105, 180, 0.2) !important; 
}

/* --- 未消化リストのスワイプ（カルーセル）対応 --- */
.unwatched-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    gap: 15px;
    padding-bottom: 10px;
    cursor: grab;
    align-items: flex-start;
}
.unwatched-slider::-webkit-scrollbar {
    display: none;
}
.unwatched-slider .unwatched-item {
    min-width: 88%;
    scroll-snap-align: center;
    margin-bottom: 0;
}
.unwatched-slider:active {
    cursor: grabbing;
}

.unwatched-dots-container {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 5px;
    margin-bottom: 15px;
}
.unwatched-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ddd;
    transition: all 0.3s ease;
}
.unwatched-dot.active {
    background-color: var(--primary);
    width: 14px;
    border-radius: 4px;
}

/* --- レポート画面：データ出力アコーディオン --- */
.export-accordion-btn {
    width: 100%;
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 12px;
    padding: 15px;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
    transition: all 0.3s ease;
}
body.has-glass-ui .export-accordion-btn {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
}
.export-accordion-btn .toggle-icon {
    transition: transform 0.3s ease;
    color: #888;
}
.export-accordion-btn.open .toggle-icon {
    transform: rotate(180deg);
}
.export-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0, 1, 0, 1);
}

/* --- 初回登録（オンボーディング）画面 --- */
#onboarding-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 10% 10%, #ffd7ea 0 12%, transparent 40%),
                radial-gradient(circle at 90% 20%, #ffe9f4 0 10%, transparent 35%),
                linear-gradient(165deg, #fff8fc, #fff5fb);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

#onboarding-screen .onboarding-content {
    box-shadow: 0 12px 30px rgba(165, 74, 120, 0.14);
    border: 1px solid #ffd9ea;
}

.unwatched-indicator {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 8px;   /* 印のサイズ */
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 3px rgba(0,0,0,0.4);
}

/* カテゴリドラッグ中のプレースホルダースタイル */
.category-box.placeholder {
    background: rgba(0,0,0,0.05);
    border: 2px dashed #ccc;
}

/* Unwatched Navigation Arrows (PC) */
.unwatched-wrapper {
    position: relative;
}
.unwatched-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--text-on-primary);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
    opacity: 0.9;
    transition: all 0.2s;
}
.unwatched-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}
.unwatched-arrow.left { left: -18px; }
.unwatched-arrow.right { right: -18px; }

@media (max-width: 768px) {
    .unwatched-arrow { display: none; }
}

/* PC Nav Buttons for Calendar/Report */
.tab-nav-arrow {
    top: 250px; /* ヘッダーの下、コンテンツ中央付近に固定 */
}
.tab-nav-arrow.left { left: 10px; }
.tab-nav-arrow.right { right: 10px; }

.tab-content { position: relative; }
