/* ============================================
   Yuji Note Generator - ダークゴールドテーマ
   v1.1.0 - 全修正込み
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+JP:wght@300;400;700&family=Space+Grotesk:wght@300;500;700&family=Playfair+Display:wght@700&display=swap');

/* ── ベース ── */
#yuji-note-app {
    font-family: 'Noto Serif JP', serif;
    background: #111318;
    color: #e8e0d0;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    padding: 2.5rem 2.5rem 6rem;
    -webkit-font-smoothing: antialiased;
}
#yuji-note-app::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* ── ヘッダー（中央寄せ・Space Grotesk統一） ── */
.yn-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}
.yn-header-sub {
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(224,184,96,0.5);
    font-family: 'Noto Serif JP', serif;
    margin-bottom: 0.6rem;
}
.yn-header-title {
    display: block;
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e0b860 0%, #f0c97a 50%, #e0b860 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: 'Noto Serif JP', serif;
    font-weight: 700;
    margin: 0 0 0.5rem;
    letter-spacing: 0.02em;
}
.yn-header-desc {
    display: block;
    font-size: 0.88rem;
    color: rgba(232,224,208,0.5);
}

/* ── レイアウト ── */
.yn-layout {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 20px;
    align-items: start;
    position: relative;
    z-index: 1;
}

/* ── 残高バー ── */
.yn-balance-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 1.25rem;
}
.yn-balance-icon { color: #e0b860; font-size: 16px; }
.yn-coin-num     { font-size: 20px; font-weight: 600; color: #e8e0d0; line-height: 1; }
.yn-balance-label{ font-size: 11px; color: rgba(232,224,208,0.4); }
.yn-buy-link {
    margin-left: auto;
    color: #e0b860;
    font-size: 12px;
    text-decoration: none;
    font-family: 'Noto Serif JP', serif;
}
.yn-buy-link:hover { opacity: 0.8; }

/* ── 左パネル ── */
.yn-panel-left {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 14px;
    padding: 1.5rem;
    backdrop-filter: blur(8px);
    position: sticky;
    top: 80px;
    transition: border-color 0.3s;
}
.yn-panel-left:hover { border-color: rgba(224,184,96,0.35); }

/* ── フィールド ── */
.yn-field { margin-bottom: 1.1rem; }
.yn-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: rgba(224,184,96,0.8);
    font-family: 'Noto Serif JP', serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.yn-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(224,184,96,0.15);
    border: 1px solid rgba(224,184,96,0.4);
    color: #e0b860;
    font-size: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Noto Serif JP', serif;
}

/* ── インプット ── */
.yn-input-row  { display: flex; gap: 8px; }
.yn-input-half { flex: 1; }
.yn-input-half,
.yn-select,
.yn-textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 0.88rem;
    border: 1px solid rgba(224,184,96,0.25);
    border-radius: 8px;
    background: rgba(0,0,0,0.35);
    color: #e8e0d0;
    box-sizing: border-box;
    font-family: 'Noto Serif JP', serif;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.yn-input-half::placeholder,
.yn-textarea::placeholder { color: rgba(232,224,208,0.3); }
.yn-input-half:focus,
.yn-select:focus,
.yn-textarea:focus {
    border-color: rgba(224,184,96,0.6);
    box-shadow: 0 0 0 3px rgba(224,184,96,0.08);
}
.yn-textarea { height: 90px; resize: vertical; }
.yn-select option { background: #1a1d24; color: #e8e0d0; }

/* ── スライダー（金色） ── */
.yn-slider-wrap { display: flex; align-items: center; gap: 12px; }
.yn-slider {
    flex: 1;
    -webkit-appearance: none;
    height: 3px;
    border-radius: 2px;
    background: rgba(224,184,96,0.25);
    cursor: pointer;
    outline: none;
    accent-color: #e0b860;
}
.yn-slider::-webkit-slider-runnable-track {
    background: rgba(224,184,96,0.25);
    height: 3px;
    border-radius: 2px;
}
.yn-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c49030, #e0b860);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 6px rgba(224,184,96,0.5);
}
.yn-slider::-moz-range-track {
    background: rgba(224,184,96,0.25);
    height: 3px;
    border-radius: 2px;
}
.yn-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c49030, #e0b860);
    border: none;
}
.yn-price-val {
    font-size: 13px;
    font-weight: 600;
    color: #e0b860;
    min-width: 60px;
    text-align: right;
    font-family: 'Noto Serif JP', serif;
}

/* ── トグルグループ（未選択を暗く） ── */
.yn-btn-group { display: flex; gap: 6px; }
.yn-toggle {
    flex: 1;
    padding: 7px 6px;
    font-size: 0.75rem;
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    color: rgba(232,224,208,0.45);
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: 'Noto Serif JP', serif;
    line-height: 1.3;
}
.yn-toggle small { display: block; font-size: 10px; color: rgba(232,224,208,0.25); }
.yn-toggle:hover {
    border-color: rgba(224,184,96,0.4);
    color: rgba(232,224,208,0.8);
}
.yn-toggle.active {
    background: rgba(224,184,96,0.15);
    border-color: rgba(224,184,96,0.6);
    color: #e0b860;
}
.yn-toggle.active small { color: rgba(224,184,96,0.5); }

/* ── スイッチ ── */
.yn-switch-wrap { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.yn-switch-label { font-size: 0.85rem; color: rgba(232,224,208,0.7); }
.yn-switch-wrap input { display: none; }
.yn-switch {
    width: 40px;
    height: 22px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.yn-switch::after {
    content: '';
    position: absolute;
    top: 3px; left: 3px;
    width: 14px; height: 14px;
    background: rgba(232,224,208,0.4);
    border-radius: 50%;
    transition: left 0.2s, background 0.2s;
}
.yn-switch-wrap input:checked ~ .yn-switch {
    background: rgba(224,184,96,0.25);
    border-color: rgba(224,184,96,0.5);
}
.yn-switch-wrap input:checked ~ .yn-switch::after {
    left: 21px;
    background: #e0b860;
}

/* ── 執筆開始ボタン ── */
.yn-start-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #c49030, #e0b860, #d4a044);
    color: #0d0f14;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 1.25rem;
    transition: opacity 0.2s, transform 0.2s;
    font-family: 'Noto Serif JP', serif;
    letter-spacing: 0.03em;
}
.yn-start-btn:hover:not(:disabled) { opacity: 0.9; transform: translateY(-1px); }
.yn-start-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.yn-start-icon { font-size: 16px; }

/* ── 右パネル ── */
.yn-panel-right {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 14px;
    overflow: hidden;
    min-height: 480px;
    backdrop-filter: blur(8px);
    transition: border-color 0.3s;
}
.yn-panel-right:hover { border-color: rgba(224,184,96,0.32); }

/* ── 空状態 ── */
.yn-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}
.yn-empty-icon  { font-size: 48px; margin-bottom: 1rem; opacity: 0.2; }
.yn-empty-title { font-size: 16px; font-weight: 500; color: rgba(232,224,208,0.5); margin-bottom: 8px; }
.yn-empty-desc  { font-size: 13px; color: rgba(232,224,208,0.3); line-height: 1.8; }

/* ── タイトル選択 ── */
.yn-section-label {
    font-size: 11px;
    color: rgba(224,184,96,0.5);
    padding: 12px 16px 8px;
    border-bottom: 1px solid rgba(224,184,96,0.1);
    font-family: 'Noto Serif JP', serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.yn-title-list { padding: 12px 16px; }
.yn-title-option {
    display: block;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 10px;
    font-size: 13px;
    color: rgba(232,224,208,0.8);
    text-align: left;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all 0.15s;
    font-family: 'Noto Serif JP', serif;
    line-height: 1.5;
}
.yn-title-option:hover   { border-color: rgba(224,184,96,0.5); color: #e8e0d0; background: rgba(224,184,96,0.06); }
.yn-title-option.selected{ background: rgba(224,184,96,0.12); color: #e0b860; border-color: rgba(224,184,96,0.6); }
.yn-loading-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 1rem 0;
    color: rgba(232,224,208,0.4);
    font-size: 13px;
}

/* ── タブ ── */
.yn-tabs { display: flex; border-bottom: 1px solid rgba(224,184,96,0.15); padding: 0 16px; }
.yn-tab {
    padding: 12px 16px;
    font-size: 12px;
    color: rgba(232,224,208,0.4);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    font-family: 'Noto Serif JP', serif;
    transition: color 0.15s;
}
.yn-tab:hover  { color: rgba(232,224,208,0.7); }
.yn-tab.active { color: #e0b860; border-bottom-color: #e0b860; }

/* ── 画像エリア ── */
.yn-image-area {
    position: relative;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    margin: 16px;
    overflow: hidden;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(224,184,96,0.1);
}
#yn-header-image { width: 100%; height: auto; display: block; border-radius: 10px; }
.yn-download-btn {
    position: absolute;
    bottom: 10px; right: 10px;
    width: 38px; height: 38px;
    background: rgba(224,184,96,0.9);
    color: #0d0f14;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.yn-image-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(232,224,208,0.4);
    font-size: 13px;
    padding: 2rem;
}
.yn-image-placeholder {
    font-size: 12px;
    color: rgba(232,224,208,0.3);
    padding: 1.5rem;
    text-align: center;
}

/* ── 記事本文 ── */
.yn-tab-content { padding: 0 16px 16px; }
.yn-article-title {
    font-size: 20px;
    font-weight: 700;
    color: #e0b860;
    line-height: 1.4;
    margin: 16px 0 12px;
    font-family: 'Noto Serif JP', serif;
}
.yn-article-body { font-size: 14px; color: rgba(232,224,208,0.85); line-height: 1.9; }
.yn-article-body h1 { font-size: 18px; margin: 1.5rem 0 .75rem; color: #e0b860; }
.yn-article-body h2 { font-size: 16px; margin: 1.25rem 0 .6rem; color: #e0b860; border-bottom: 1px solid rgba(224,184,96,0.2); padding-bottom: .4rem; }
.yn-article-body h3 { font-size: 14px; margin: 1rem 0 .5rem; color: rgba(224,184,96,0.8); }
.yn-article-body p  { margin: 0 0 1rem; }
.yn-article-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 2rem 0;
    color: rgba(232,224,208,0.4);
    font-size: 13px;
}

/* ── Xポスト ── */
.yn-xpost-body {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(224,184,96,0.2);
    border-radius: 10px;
    padding: 1rem;
    font-size: 14px;
    color: rgba(232,224,208,0.85);
    line-height: 1.7;
    white-space: pre-wrap;
    margin-top: 16px;
}

/* ── スピナー ── */
.yn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(224,184,96,0.2);
    border-top-color: #e0b860;
    border-radius: 50%;
    animation: yn-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes yn-spin { to { transform: rotate(360deg); } }

/* ── アクションバー ── */
.yn-action-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(17,19,24,0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(224,184,96,0.2);
    padding: 12px 24px;
    display: flex;
    gap: 10px;
    justify-content: center;
    z-index: 100;
}
.yn-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 22px;
    font-size: 13px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid rgba(224,184,96,0.3);
    background: rgba(255,255,255,0.04);
    color: rgba(232,224,208,0.8);
    text-decoration: none;
    font-family: 'Noto Serif JP', serif;
    transition: all 0.15s;
}
.yn-action-btn:hover { border-color: rgba(224,184,96,0.6); color: #e0b860; }
.yn-copy-btn {
    background: linear-gradient(135deg, #c49030, #e0b860) !important;
    color: #0d0f14 !important;
    border-color: transparent !important;
    font-weight: 700;
}
.yn-copy-btn:hover { opacity: 0.9 !important; }
.yn-note-btn { border-color: rgba(65,201,180,0.4) !important; color: #41C9B4 !important; }
.yn-note-btn:hover { background: rgba(65,201,180,0.08) !important; border-color: rgba(65,201,180,0.7) !important; }
.yn-x-btn:hover { border-color: rgba(255,255,255,0.4); color: #fff; }

/* ── レスポンシブ ── */
@media (max-width: 768px) {
    #yuji-note-app { padding: 1.25rem 1rem 6rem; }
    .yn-layout { grid-template-columns: 1fr; }
    .yn-panel-left { position: static; }
    .yn-header-title { font-size: 1.6rem; }
    .yn-action-bar { padding: 10px; gap: 6px; }
    .yn-action-btn { padding: 8px 14px; font-size: 12px; }
}
