/* ===================================================================
 * DVTV-01 GPU Monitor v2.5.0 — Liquid Glass
 * DVTV-000 依存
 * =================================================================== */

.dvtv-gpu-root {
    display: inline-block;
    width: 100%;
    color: var(--pine-text);
}
.dvtv-gpu-widget {
    padding: 14px 14px 12px;
    border-radius: var(--radius-lg);
    display: flex; flex-direction: column; gap: 10px;
    max-width: 300px;
}

/* --- ヘッダー --- */
.dvtv-gpu-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px;
    padding-bottom: 9px;
    border-bottom: 1px solid rgba(148,163,184,0.18);
}
.pine-dark .dvtv-gpu-head,
[data-theme="dark"] .dvtv-gpu-head {
    border-bottom-color: rgba(255,255,255,0.08);
}
.dvtv-gpu-head-left {
    display: flex; align-items: center; gap: 8px;
    min-width: 0;
}
.dvtv-gpu-title {
    font-size: 13px; font-weight: 700;
    color: var(--pine-text); letter-spacing: -0.01em;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dvtv-gpu-updated {
    display: inline-flex; align-items: center; gap: 6px;
    flex-shrink: 0;
}
.dvtv-gpu-updated-time {
    font-size: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
}

/* --- ボディ --- */
.dvtv-gpu-widget > .dvtv-gpu-body {
    display: flex; flex-direction: column; gap: 8px;
}
.dvtv-gpu-loading {
    text-align: center; padding: 20px 8px;
    color: var(--pine-text-3); font-size: 11px;
}
.dvtv-gpu-error {
    padding: 10px 12px; border-radius: 10px;
    background: rgba(244,63,94,0.12);
    border: 1px solid rgba(244,63,94,0.3);
    color: #be123c; font-size: 11px; font-weight: 600;
    text-align: center;
}
.pine-dark .dvtv-gpu-error,
[data-theme="dark"] .dvtv-gpu-error {
    color: #fda4af;
    background: rgba(244,63,94,0.18);
    border-color: rgba(244,63,94,0.35);
}

/* --- GPUカード (JSで生成) --- */
.dvtv-gpu-card {
    position: relative;
    padding: 11px 12px 11px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
    overflow: hidden;
}
.pine-dark .dvtv-gpu-card,
[data-theme="dark"] .dvtv-gpu-card {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}

/* 左側の色バー (GPU0=red, GPU1=green, その他=blue) */
.dvtv-gpu-bar {
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    border-radius: 12px 0 0 12px;
}
.dvtv-gpu-bar-red   { background: linear-gradient(180deg, #fda4af 0%, #e11d48 100%); box-shadow: 0 0 12px rgba(244,63,94,0.4); }
.dvtv-gpu-bar-green { background: linear-gradient(180deg, #6ee7b7 0%, #059669 100%); box-shadow: 0 0 12px rgba(16,185,129,0.4); }
.dvtv-gpu-bar-blue  { background: linear-gradient(180deg, #93c5fd 0%, #2563eb 100%); box-shadow: 0 0 12px rgba(59,130,246,0.4); }

.dvtv-gpu-card-inner {
    display: flex; flex-direction: column; gap: 8px;
}
.dvtv-gpu-card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.dvtv-gpu-card-title {
    font-size: 13px; font-weight: 800;
    color: var(--pine-text);
    letter-spacing: -0.01em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.dvtv-gpu-card-temp {
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
    background: linear-gradient(180deg, rgba(134,239,172,0.45), rgba(16,185,129,0.28));
    color: #065f46;
    border: 1px solid rgba(134,239,172,0.6);
    font-family: ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}
.dvtv-gpu-card-temp.high {
    background: linear-gradient(180deg, rgba(252,165,165,0.45), rgba(239,68,68,0.28));
    color: #9f1239;
    border-color: rgba(252,165,165,0.65);
    animation: gpuPulse 1.4s ease-in-out infinite;
}
.pine-dark .dvtv-gpu-card-temp,
[data-theme="dark"] .dvtv-gpu-card-temp { color: #86efac; }
.pine-dark .dvtv-gpu-card-temp.high,
[data-theme="dark"] .dvtv-gpu-card-temp.high { color: #fda4af; }
@keyframes gpuPulse {
    0%, 100% { box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 0 0 0 rgba(239,68,68,0.5); }
    50%      { box-shadow: inset 0 1px 0 rgba(255,255,255,0.85), 0 0 0 4px rgba(239,68,68,0); }
}

/* メトリクス 3つのピル */
.dvtv-gpu-card-metrics {
    display: flex; flex-wrap: wrap; gap: 5px;
}
.dvtv-gpu-metric {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    font-size: 11px; font-weight: 700;
    color: var(--pine-text-2);
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(255,255,255,0.65);
    border-radius: 999px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.85);
}
.pine-dark .dvtv-gpu-metric,
[data-theme="dark"] .dvtv-gpu-metric {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.12);
    color: var(--pine-text-2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
}
.dvtv-gpu-metric-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--pine-text-4);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* --- フッター --- */
.dvtv-gpu-foot {
    text-align: right;
    margin-top: 2px;
}
.dvtv-gpu-status {
    font-size: 10px; padding: 2px 10px;
}

/* --- 旧クラス互換 (念のため) --- */
.dvtv-gpu-temp-high { /* JS側 .high に統合 */ }

/* ===================================================================
 * コンパクトモード (compact="1") — 2段構造
 * [icon + GPU温度 横並び + chip] / [label + 時刻 | meta pills]
 * =================================================================== */
.dvtv-gpu-compact {
    display: block;
    width: 100%;
    max-width: none;
    height: 100%;
}
.dvtv-gpu-stat {
    padding: 8px 12px;
    display: flex; flex-direction: column;
    gap: 2px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    width: 100%;
    height: 100%;
    min-height: 64px;
    box-sizing: border-box;
}
.dvtv-gpu-stat * { min-width: 0; box-sizing: border-box; }

/* 1段目: ビーズ + GPU温度横並び + チップ */
.dvtv-gpu-stat-top {
    display: flex; align-items: center;
    gap: 8px;
    min-height: 30px;
}
.dvtv-gpu-stat-top .bead { flex-shrink: 0; }

/* メイン: GPU温度バッジ横並び (強制横並び) */
.dvtv-gpu-stat-main {
    flex: 1 1 auto;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 5px;
    align-items: center;
    overflow: hidden;
    padding: 0 !important;
    margin: 0 !important;
}
.dvtv-gpu-stat-loading {
    font-size: 10px; color: var(--pine-text-3);
    padding: 2px;
}

.dvtv-gpu-stat-gpu {
    position: relative;
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    padding: 2px 9px 2px 17px;
    border-radius: 999px;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.55);
    backdrop-filter: blur(8px) saturate(160%);
    -webkit-backdrop-filter: blur(8px) saturate(160%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.75);
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
}
.pine-dark .dvtv-gpu-stat-gpu,
[data-theme="dark"] .dvtv-gpu-stat-gpu {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

/* 色LED (左端) */
.dvtv-gpu-stat-gpu::before {
    content: '';
    position: absolute;
    left: 6px; top: 50%;
    transform: translateY(-50%);
    width: 6px; height: 6px;
    border-radius: 50%;
}
.dvtv-gpu-gpu-red::before   { background: #ef4444; box-shadow: 0 0 6px rgba(239,68,68,0.7); }
.dvtv-gpu-gpu-green::before { background: #10b981; box-shadow: 0 0 6px rgba(16,185,129,0.7); }
.dvtv-gpu-gpu-blue::before  { background: #3b82f6; box-shadow: 0 0 6px rgba(59,130,246,0.7); }

/* GPU番号 (0, 1, 2 ...) */
.dvtv-gpu-stat-gpu-idx {
    font-size: 11px;
    font-weight: 800;
    color: var(--pine-text-3);
    letter-spacing: 0;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    opacity: 0.6;
}
.dvtv-gpu-stat-gpu-temp {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: linear-gradient(135deg, #1e293b 0%, #3b82f6 80%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dvtv-gpu-gpu-red .dvtv-gpu-stat-gpu-temp {
    background: linear-gradient(135deg, #1e293b 0%, #ef4444 80%);
    -webkit-background-clip: text; background-clip: text;
}
.dvtv-gpu-gpu-green .dvtv-gpu-stat-gpu-temp {
    background: linear-gradient(135deg, #1e293b 0%, #10b981 80%);
    -webkit-background-clip: text; background-clip: text;
}
.pine-dark .dvtv-gpu-stat-gpu-temp,
[data-theme="dark"] .dvtv-gpu-stat-gpu-temp {
    background: linear-gradient(135deg, #f1f5f9 0%, #93c5fd 80%);
    -webkit-background-clip: text; background-clip: text;
}

.dvtv-gpu-stat-gpu.high {
    background: linear-gradient(180deg, rgba(252,165,165,0.4), rgba(239,68,68,0.25)) !important;
    border-color: rgba(252,165,165,0.7) !important;
    animation: gpuPulse 1.4s ease-in-out infinite;
}
.dvtv-gpu-stat-gpu.high .dvtv-gpu-stat-gpu-temp {
    background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 80%);
    -webkit-background-clip: text; background-clip: text;
}

.dvtv-gpu-stat-chip {
    flex-shrink: 0;
    font-size: 9px;
    padding: 2px 8px;
}

/* 2段目: ラベル(左) + メタ(右) */
.dvtv-gpu-stat-bottom {
    display: flex; align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.dvtv-gpu-stat-label {
    font-size: 10px;
    color: var(--pine-text-3);
    font-weight: 500;
    letter-spacing: 0.02em;
    display: inline-flex; align-items: center; gap: 4px;
    line-height: 1.2;
    flex-shrink: 0;
    white-space: nowrap;
}
.dvtv-gpu-stat-label .dvtv-gpu-updated-time {
    font-family: ui-monospace, monospace;
    font-size: 9px;
    color: var(--pine-text-4);
    font-variant-numeric: tabular-nums;
    margin-left: 3px;
}

.dvtv-gpu-stat-meta {
    flex: 1 1 auto;
    display: flex; flex-wrap: wrap; gap: 2px;
    justify-content: flex-end;
}
.dvtv-gpu-meta-pill {
    font-size: 8.5px; font-weight: 500;
    color: var(--pine-text-3);
    padding: 1px 6px;
    background: rgba(255,255,255,0.4);
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 999px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    line-height: 1.4;
}
.dvtv-gpu-meta-pill b { color: var(--pine-text); font-weight: 700; }
.pine-dark .dvtv-gpu-meta-pill,
[data-theme="dark"] .dvtv-gpu-meta-pill {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.1);
}
