/* Vxop Edit V1.0 - 編輯器樣式 (BEM 重構) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Roboto, 'Noto Sans TC', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0d1117;
    overflow-y: auto;
    color: #c9d1d9;
}

/* ===== intro（站點介紹） ===== */
.intro {
    flex-shrink: 0;
    padding: 28px 24px 16px;
    background: #0d1117;
}

.intro__content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.intro__title {
    font-size: 1.8rem;
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 10px;
    letter-spacing: -0.3px;
}

.intro__desc {
    font-size: 0.95rem;
    color: #8b949e;
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

.intro__note {
    font-size: 0.85rem;
    color: #58a6ff;
    margin-top: 10px;
    padding: 8px 14px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    max-width: 100%;
}

.intro__auth {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.intro__auth-user {
    font-size: 0.85rem;
    color: #8b949e;
}

.intro__auth-link {
    font-size: 0.85rem;
    color: #58a6ff;
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #161b22;
    transition: background 0.2s;
}

.intro__auth-link:hover {
    background: #30363d;
    color: #79c0ff;
}

/* ===== editor（編輯器） ===== */
.editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 24px 24px;
}

.editor__toolbar {
    background: #161b22;
    border: 1px solid #30363d;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-direction: column;
    padding: 6px 16px;
    flex-shrink: 0;
    gap: 4px;
}

.editor__tools {
    display: flex;
    gap: 2px;
    align-items: center;
}

.editor__tools--row1 .editor__btn {
    font-size: 13px;
    color: #c9d1d9;
}

.editor__tools--row1 .editor__btn:hover {
    color: #f0f6fc;
}

.editor__tools--row3 .editor__btn {
    font-size: 14px;
}

.editor__btn {
    width: 34px;
    height: 34px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #c9d1d9;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
}

.editor__btn:hover {
    background: #30363d;
    color: #f0f6fc;
}

.editor__btn:active {
    background: #21262d;
    transform: scale(0.96);
}

.editor__btn--bold { font-weight: 700; }
.editor__btn--italic { font-style: italic; }
.editor__btn--underline { text-decoration: underline; }
.editor__btn--strikethrough { text-decoration: line-through; }

.editor__btn--swap {
    color: #79c0ff;
    font-size: 18px;
}

.editor__btn--swap:hover {
    background: #58a6ff33;
    color: #a5d6ff;
}

.editor__btn--preview {
    color: #79c0ff;
    font-size: 18px;
}

.editor__btn--preview:hover {
    background: #58a6ff33;
    color: #a5d6ff;
}

.editor__btn--download {
    color: #3fb950;
    font-size: 18px;
}

.editor__btn--download:hover {
    background: #2ea04333;
    color: #56d364;
}

.editor__select {
    height: 30px;
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 0 8px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.editor__select:hover {
    border-color: #58a6ff;
}

.editor__select:focus {
    border-color: #58a6ff;
}

.editor__btn--color {
    font-size: 16px;
    font-weight: 700;
}

.editor__color {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #30363d;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
}

.editor__color::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.editor__color::-webkit-color-swatch {
    border: 1px solid #484f58;
    border-radius: 2px;
}

.editor__divider {
    width: 1px;
    height: 22px;
    background: #30363d;
    margin: 0 10px;
}

.editor__main {
    flex: 1;
    display: flex;
    position: relative;
    background: #0d1117;
    overflow: hidden;
    border: 1px solid #30363d;
    border-top: none;
    border-radius: 0 0 10px 10px;
    min-height: 0;
}

.editor__preview {
    flex: 1 1 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    position: relative;
}

.editor__preview-header {
    height: 40px;
    background: #f6f8fa;
    border-bottom: 1px solid #d0d7de;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #24292f;
    gap: 8px;
    flex-shrink: 0;
    -webkit-user-select: none;
    user-select: none;
}

.editor__preview-header span {
    color: #57606a;
    font-weight: 400;
}

.editor__preview-body {
    flex: 1;
    padding: 24px 32px;
    overflow-y: auto;
    background: #ffffff;
    font-size: 16px;
    line-height: 1.7;
    color: #1f2328;
    font-family: 'Segoe UI', 'Noto Sans TC', system-ui, sans-serif;
    outline: none;
    border: none;
    min-height: 500px;
}

.editor__preview-body h2 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: #0d1117;
    letter-spacing: -0.3px;
}

.editor__preview-body p {
    margin-bottom: 1.2rem;
}

.editor__preview-body .highlight-card {
    background: #f0f6ff;
    border-left: 4px solid #0969da;
    padding: 14px 20px;
    margin: 1.5rem 0;
    border-radius: 0 12px 12px 0;
    font-weight: 450;
    color: #1f2328;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.editor__preview-body .note {
    color: #656d76;
    font-size: 0.9rem;
    margin-top: 2rem;
    border-top: 1px solid #eaeef2;
    padding-top: 1.2rem;
}

.editor__preview-body::-webkit-scrollbar { width: 8px; }
.editor__preview-body::-webkit-scrollbar-track { background: #f6f8fa; border-radius: 8px; }
.editor__preview-body::-webkit-scrollbar-thumb { background: #c1c8cd; border-radius: 8px; }
.editor__preview-body::-webkit-scrollbar-thumb:hover { background: #a0a6ac; }

.editor__code-panel {
    flex: 1 1 0;
    background: #0d1117;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor__code-header {
    height: 40px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8b949e;
    gap: 8px;
    flex-shrink: 0;
}

.editor__code-header span {
    color: #58a6ff;
    font-weight: 500;
}

.editor__code-area {
    flex: 1;
    padding: 24px 24px;
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.75;
    color: #c9d1d9;
    white-space: pre-wrap;
    overflow-y: auto;
    background: #0d1117;
    border: none;
    outline: none;
    resize: none;
    tab-size: 2;
}

.editor__code-area[contenteditable="true"] {
    caret-color: #58a6ff;
}

.editor__code-area::-webkit-scrollbar { width: 8px; }
.editor__code-area::-webkit-scrollbar-track { background: #161b22; }
.editor__code-area::-webkit-scrollbar-thumb { background: #30363d; border-radius: 8px; }
.editor__code-area::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* 可拖曳分隔手柄 */
.editor__resize {
    width: 6px;
    background: #21262d;
    cursor: col-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, width 0.15s;
    position: relative;
    z-index: 15;
    border-left: 1px solid #30363d;
    border-right: 1px solid #30363d;
}

.editor__resize:hover {
    background: #388bfd;
    width: 8px;
    border-color: #388bfd;
}

.editor__resize-dots {
    display: flex;
    flex-direction: column;
    gap: 5px;
    opacity: 0.8;
}

.editor__resize-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #8b949e;
    display: block;
    transition: background 0.2s;
}

.editor__resize:hover .editor__resize-dots span {
    background: #ffffff;
}

/* ===== modal（對話框／預覽浮窗，共用 overlay） ===== */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal.is-open {
    display: flex;
}

.modal__content {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #30363d;
    font-size: 1rem;
    font-weight: 600;
    color: #f0f6fc;
    flex-shrink: 0;
}

.modal__close {
    background: none;
    border: none;
    color: #8b949e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.modal__close:hover {
    color: #f0f6fc;
}

.modal__body {
    flex: 1;
    overflow-y: auto;
}

.modal__body img {
    max-width: 100%;
}

.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid #30363d;
    flex-shrink: 0;
}

.modal__row {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.modal__row > div {
    flex: 1;
}

.modal__row label {
    margin-top: 0;
}

.modal__btn {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.modal__btn--cancel {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.modal__btn--cancel:hover {
    background: #30363d;
}

.modal__btn--confirm {
    background: #238636;
    color: #ffffff;
}

.modal__btn--confirm:hover {
    background: #2ea043;
}

/* --preview modifier（預覽浮窗） */
.modal--preview {
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
}

.modal--preview .modal__content {
    background: #ffffff;
    width: 80vw;
    max-width: 900px;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.modal--preview .modal__header {
    height: 44px;
    background: #161b22;
    border-bottom: 1px solid #30363d;
    color: #f0f6fc;
    font-weight: 600;
    font-size: 0.9rem;
}

.modal--preview .modal__close {
    color: #8b949e;
    font-size: 1.6rem;
}

.modal--preview .modal__close:hover {
    color: #f0f6fc;
}

.modal--preview .modal__body {
    padding: 28px 32px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    color: #1f2328;
}

/* --dialog modifier（儲存對話框） */
.modal--dialog .modal__content {
    width: 420px;
    max-width: 90vw;
}

.modal--dialog .modal__body {
    padding: 20px;
}

.modal--dialog .modal__body label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: #8b949e;
    margin-bottom: 6px;
    margin-top: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal--dialog .modal__body label:first-child {
    margin-top: 0;
}

.modal--dialog .modal__body input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

.modal--dialog .modal__body input[type="text"]:focus {
    border-color: #58a6ff;
}

/* ===== table（表格相關） ===== */
.table__picker {
    position: fixed;
    z-index: 1100;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.table__picker-label {
    text-align: center;
    font-size: 12px;
    color: #8b949e;
    margin-bottom: 6px;
}

.table__picker-border {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid #30363d;
}

.table__picker-border label {
    font-size: 12px;
    color: #8b949e;
}

.table__picker-border input {
    width: 50px;
    height: 24px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 4px;
    color: #c9d1d9;
    font-size: 12px;
    padding: 0 6px;
    outline: none;
    text-align: center;
}

.table__picker-border input:focus {
    border-color: #58a6ff;
}

.table__picker-border input[type="number"]::-webkit-outer-spin-button,
.table__picker-border input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.table__picker-border input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

.table__picker-grid {
    display: grid;
    grid-template-columns: repeat(4, 20px);
    gap: 2px;
}

.table__picker-cell {
    width: 16px;
    height: 16px;
    background: #30363d;
    border: 1px solid #484f58;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.15s;
}

.table__picker-cell.is-active {
    background: #58a6ff;
    border-color: #79c0ff;
}

.table__picker-cell:hover {
    background: #58a6ff44;
}

.table__resize {
    position: absolute;
    top: 0;
    right: -3px;
    width: 6px;
    height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.15s;
}

.table__resize:hover,
.table__resize.is-active {
    background: #58a6ff66;
}

.table__resize-guide {
    position: fixed;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #58a6ff;
    z-index: 9999;
    pointer-events: none;
}

/* ===== footer（頁尾） ===== */
.footer {
    flex-shrink: 0;
    text-align: center;
    padding: 12px 24px;
    background: #0d1117;
    border-top: 1px solid #21262d;
}

.footer__text {
    font-size: 0.8rem;
    color: #8b949e;
}

.footer__link {
    color: #58a6ff;
    text-decoration: none;
}

.footer__link:hover {
    color: #79c0ff;
    text-decoration: underline;
}

/* ===== help（教學頁面） ===== */
.help {
    max-width: 800px;
    width: 100%;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 12px;
    padding: 30px;
    margin: 20px auto;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.help__title {
    font-size: 24px;
    margin: 0 0 8px 0;
    color: #f0f6fc;
}

.help__subtitle {
    color: #8b949e;
    font-size: 14px;
    margin-bottom: 24px;
}

.help__back {
    display: inline-block;
    margin-bottom: 20px;
    color: #58a6ff;
    text-decoration: none;
    font-size: 14px;
}

.help__back:hover {
    text-decoration: underline;
}

.help__table {
    width: 100%;
    border-collapse: collapse;
}

.help__table th {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 2px solid #30363d;
    color: #f0f6fc;
    font-size: 14px;
}

.help__table td {
    padding: 10px 12px;
    border-bottom: 1px solid #21262d;
    font-size: 14px;
    vertical-align: top;
}

.help__table tr:hover td {
    background: #1c2128;
}

.help__tool-name {
    color: #58a6ff;
    font-weight: 600;
    white-space: nowrap;
}

.help__tip {
    margin-top: 24px;
    padding: 12px 16px;
    background: #1c2128;
    border-radius: 8px;
    color: #8b949e;
    font-size: 13px;
    border-left: 3px solid #58a6ff;
}

/* ===== page-home（首頁 landing） ===== */
.page-home {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #0d1117;
}

.page-home__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid #21262d;
    flex-shrink: 0;
}

.page-home__logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f0f6fc;
    text-decoration: none;
}

.page-home__logo span {
    color: #58a6ff;
}

.page-home__nav {
    display: flex;
    gap: 12px;
}

.page-home__nav-link {
    padding: 8px 18px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
}

.page-home__nav-link--primary {
    background: #238636;
    color: #fff;
}

.page-home__nav-link--primary:hover {
    background: #2ea043;
}

.page-home__nav-link--secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.page-home__nav-link--secondary:hover {
    background: #30363d;
}

.page-home__nav-link--ghost {
    color: #8b949e;
}

.page-home__nav-link--ghost:hover {
    color: #f0f6fc;
}

.page-home__hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 24px 60px;
}

.page-home__hero-title {
    font-size: 3rem;
    font-weight: 700;
    color: #f0f6fc;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.page-home__hero-title span {
    color: #58a6ff;
}

.page-home__hero-desc {
    font-size: 1.15rem;
    color: #8b949e;
    max-width: 640px;
    line-height: 1.7;
    margin-bottom: 32px;
}

.page-home__cta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.page-home__cta-link {
    padding: 14px 32px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
}

.page-home__cta-link--primary {
    background: #238636;
    color: #fff;
}

.page-home__cta-link--primary:hover {
    background: #2ea043;
}

.page-home__cta-link--secondary {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

.page-home__cta-link--secondary:hover {
    background: #30363d;
}

.page-home__features {
    padding: 60px 24px 80px;
    max-width: 1100px;
    margin: 0 auto;
}

.page-home__features-title {
    text-align: center;
    font-size: 1.8rem;
    color: #f0f6fc;
    margin-bottom: 40px;
}

.page-home__features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.page-home__card {
    background: #161b22;
    border: 1px solid #21262d;
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.2s;
}

.page-home__card:hover {
    border-color: #30363d;
}

.page-home__card-icon {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.page-home__card-title {
    color: #f0f6fc;
    font-size: 1.05rem;
    margin-bottom: 8px;
}

.page-home__card-desc {
    color: #8b949e;
    font-size: 0.85rem;
    line-height: 1.6;
}

.page-home__footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid #21262d;
    color: #8b949e;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.page-home__footer a {
    color: #58a6ff;
    text-decoration: none;
}

.page-home__footer a:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .editor__btn { width: 30px; height: 30px; }
}

@media (max-width: 640px) {
    .page-home__header { padding: 16px 20px; flex-direction: column; gap: 12px; }
    .page-home__hero-title { font-size: 2rem; }
    .page-home__hero-desc { font-size: 1rem; }
}

@media (max-width: 600px) {
    .help {
        padding: 16px;
        margin: 10px;
    }
    .help__table td, .help__table th {
        padding: 8px 6px;
        font-size: 13px;
    }
}

/* ===== 語法高亮 ===== */
.hl-tag { color: #ff7b72; }
.hl-attr { color: #79c0ff; }
.hl-value { color: #a5d6ff; }
.hl-comment { color: #8b949e; font-style: italic; }
.hl-text { color: #c9d1d9; }