/* 观易 H5 智慧解读 / 经典六爻 */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: #E6F2FF;
    background: linear-gradient(180deg, #E6F2FF 0%, #f0ebe8 55%, #e8eef5 100%);
    color: #1a2a3a;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.page-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: url('/static/h5/img/landscape-bg.png') center center / cover no-repeat;
    opacity: 0.32;
}

.page-shell {
    position: relative;
    z-index: 1;
    max-width: 480px;
    margin: 0 auto;
    padding: 12px 16px 48px;
}

.page-header {
    text-align: center;
    padding: 20px 8px 12px;
}
.page-title {
    font-size: 26px;
    font-weight: 700;
    color: #1a2a3a;
    letter-spacing: 0.06em;
}
.page-subtitle {
    margin-top: 8px;
    font-size: 14px;
    color: #5a6f84;
}

.glass-panel {
    margin-top: 14px;
    padding: 18px 16px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.65);
    box-shadow: 0 4px 24px rgba(74, 117, 111, 0.08);
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1a2a3a;
    margin-bottom: 12px;
}
.section-title-inline {
    display: inline-block;
    margin-bottom: 0;
    margin-right: 8px;
}
.panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    margin-bottom: 10px;
}
.hex-name {
    font-size: 14px;
    font-weight: 600;
    color: #4A756F;
}

/* 空亡 chip（在anchor-row日建右侧） */
.kongwang-chip {
    margin-left: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #b8892e;
    background: rgba(184,137,46,0.08);
    border: 1px solid rgba(184,137,46,0.2);
    border-radius: 14px;
    padding: 2px 10px;
    white-space: nowrap;
}

/* 问题区 */
.question-input-wrapper { margin-bottom: 6px; }
.question-input {
    width: 100%;
    min-height: 100px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.5);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    font-size: 15px;
    color: #1a2a3a;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.question-input:focus {
    border-color: rgba(91, 140, 255, 0.45);
}
.char-count {
    text-align: right;
    font-size: 12px;
    color: #8a96a6;
    margin-top: 4px;
}
.char-count.warn { color: #dd3e3e; }
.question-tip {
    margin-top: 10px;
    font-size: 12px;
    color: #8a8a9e;
    line-height: 1.55;
    font-style: italic;
}

.cast-time-section { margin-top: 14px; }
.cast-time-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.cast-time-label {
    font-size: 15px;
    color: #1a2a3a;
    font-weight: 500;
    white-space: nowrap;
}
.cast-time-field { flex: 1; min-width: 0; }
.cast-time-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 999px;
    border: 1px solid rgba(196, 179, 149, 0.75);
    background: rgba(91, 140, 133, 0.1);
    font-size: 14px;
    color: #333;
    outline: none;
}
.cast-time-hint {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #8a8a9e;
}
.time-derived {
    margin-top: 10px;
    font-size: 13px;
    color: #4A756F;
    line-height: 1.5;
}
.time-derived .sep { color: #b0b8c4; }
.input-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #b15622;
}
.input-hint.ok { color: #4A756F; }

/* 经典六爻录入 */
.manual-tip {
    font-size: 13px;
    color: #5a6f84;
    line-height: 1.6;
    margin-bottom: 12px;
}
.btn-start-manual {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 999px;
    border: 1px solid rgba(91, 140, 255, 0.25);
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.15) 0%, rgba(74, 117, 111, 0.08) 100%);
    color: #1a2a3a;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn-start-manual.hidden { display: none; }

.lines-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.line-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 8px rgba(91, 140, 255, 0.06);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    background-image: linear-gradient(135deg, rgba(91, 140, 255, 0.04) 0%, transparent 50%);
}
.line-item:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(91, 140, 255, 0.12);
}
.line-item.line-empty {
    opacity: 0.72;
    border-style: dashed;
    background: rgba(255, 255, 255, 0.28);
}
.line-number {
    width: 44px;
    font-size: 14px;
    font-weight: 600;
    color: #1a2a3a;
    flex-shrink: 0;
}
.line-symbol-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}
.line-symbol {
    font-size: 22px;
    font-weight: 600;
    color: #4A756F;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}
.line-placeholder {
    font-size: 13px;
    color: #8a8a9e;
    font-weight: 400;
    font-family: inherit;
    letter-spacing: 0;
}
.line-type {
    width: 52px;
    text-align: right;
    font-size: 13px;
    color: #5a6f84;
    font-weight: 500;
    flex-shrink: 0;
}
.line-type.unset { color: #b0b8c4; font-size: 12px; }

.btn-generate {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, #5B8CFF 0%, #7B9EFF 50%, #4A756F 100%);
    box-shadow: 0 8px 24px rgba(91, 140, 255, 0.35);
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn-generate:active:not(:disabled) { transform: scale(0.98); }
.btn-generate:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.cast-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #b15622;
    text-align: center;
}
.cast-hint.ok { color: #4A756F; }

.disclaimer-box {
    margin-top: 16px;
    padding: 12px 14px;
    background: rgba(255, 193, 7, 0.12);
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}
.disclaimer-text {
    font-size: 12px;
    color: #c9a227;
    line-height: 1.6;
}

.anchor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.anchor-chip {
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    color: #305b67;
    background: rgba(91, 140, 255, 0.1);
    border: 1px solid rgba(91, 140, 255, 0.22);
    cursor: pointer;
}
.anchor-chip.is-selected {
    background: rgba(91, 140, 255, 0.22);
    font-weight: 600;
}
.board-relation-tip {
    margin: 8px 0 4px;
    font-size: 12px;
    color: #8a96a6;
}
.cast-panel .legend-row {
    margin-top: 12px;
}
.cast-panel .target-row {
    margin-top: 8px;
}
.cast-panel .relation-list {
    margin-top: 8px;
    max-height: 220px;
    overflow-y: auto;
}

/* 关系连线层 */
.board-stage {
    position: relative;
    z-index: 1;
}
.seg-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
}
.seg-item {
    position: absolute;
    height: 3px;
    transform-origin: left center;
    border-radius: 2px;
    pointer-events: none;
}
.seg-item::after {
    content: '';
    position: absolute;
    right: -6px;
    top: -5px;
    width: 0;
    height: 0;
    border-left: 8px solid currentColor;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}
.seg-label {
    position: absolute;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 6;
    text-shadow: 0 0 4px rgba(255,255,255,0.9), 0 0 2px #fff;
}

/* 盘面排盘表格（与小程序排盘表格一致：六神 | 伏爻 | 本卦 | 变卦） */
.pan-table {
    margin-top: 4px;
    position: relative;
    z-index: 3;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.35);
}
.pan-table-header {
    display: grid;
    grid-template-columns: 42px 44px 1fr 1fr;
    align-items: center;
    padding: 8px 6px;
    background: rgba(91, 140, 111, 0.1);
    border-bottom: 1px solid rgba(91, 140, 111, 0.18);
    font-size: 12px;
    font-weight: 700;
    color: #3a5a4f;
    text-align: center;
}
.pan-row {
    display: grid;
    grid-template-columns: 42px 44px 1fr 1fr;
    align-items: center;
    min-height: 40px;
    padding: 6px;
    border-bottom: 1px solid rgba(91, 140, 111, 0.08);
    cursor: pointer;
    transition: background 0.15s ease;
}
.pan-row:last-child { border-bottom: none; }
.pan-row.is-selected {
    background: rgba(91, 140, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(91, 140, 255, 0.35);
}
.pan-col {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
    font-size: 13px;
    color: #1a2a3a;
    min-width: 0;
    padding: 2px 3px;
}
.pan-col-god {
    font-size: 12px;
    font-weight: 700;
    color: #3562aa;
    justify-content: center;
}
.pan-col-fu {
    font-size: 11px;
    color: #7a6a4a;
    justify-content: center;
}
.pan-col-ben, .pan-col-bian {
    justify-content: flex-start;
    gap: 3px;
}
.pan-ben-text, .pan-bian-text {
    font-size: 13px;
    color: #1a2a3a;
    font-weight: 500;
    white-space: nowrap;
}
.pan-symbol {
    font-size: 14px;
    font-weight: 700;
    color: #1a2a3a;
    font-family: 'Courier New', 'PingFang SC', 'Microsoft YaHei', monospace;
    letter-spacing: 1px;
    white-space: nowrap;
}
.pan-role-shi {
    font-size: 11px;
    font-weight: 800;
    color: #d73f3f;
    padding: 0 2px;
}
.pan-role-ying {
    font-size: 11px;
    font-weight: 800;
    color: #2d74d5;
    padding: 0 2px;
}
.pan-role-kong {
    font-size: 10px;
    font-weight: 600;
    color: #b8892e;
    padding: 0 2px;
}
.pan-role-dong {
    font-size: 10px;
    font-weight: 700;
    color: #e5a015;
    padding: 0 2px;
}

.legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #4f657b;
}
.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.target-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.target-chip {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(91, 140, 255, 0.22);
    background: rgba(255, 255, 255, 0.75);
    font-size: 13px;
    color: #405767;
    cursor: pointer;
}
.target-chip.active {
    color: #fff;
    background: linear-gradient(135deg, #5B8CFF, #4A756F);
    border-color: transparent;
}
.canvas-wrap { width: 100%; overflow-x: auto; margin-bottom: 10px; }
#relationCanvas { display: block; max-width: 100%; }
.relation-list { margin-top: 8px; }
.relation-item {
    padding: 10px 0;
    border-bottom: 1px solid rgba(91, 140, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.relation-item:last-child { border-bottom: none; }
.rel-type { display: flex; align-items: center; gap: 6px; }
.rel-dot { width: 14px; height: 14px; border-radius: 50%; }
.rel-text { font-size: 13px; color: #4f657b; }
.rel-sentence {
    font-size: 14px;
    color: #1a2a3a;
    flex: 1;
    margin-left: 10px;
}

.hex-summary {
    padding: 12px 14px;
    margin-bottom: 12px;
    border-radius: 10px;
    background: rgba(91, 140, 255, 0.08);
    font-size: 14px;
    color: #4A756F;
    text-align: center;
}
.interpretation-content {
    font-size: 14px;
    color: #1a2a3a;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
}
.interpretation-content h2,
.interpretation-content h3 {
    font-size: 15px;
    margin: 14px 0 6px;
    color: #4A756F;
}
.interpretation-content p { margin: 6px 0; }
.interpret-empty {
    padding: 14px;
    border-radius: 10px;
    background: rgba(255, 193, 7, 0.1);
    border-left: 4px solid #ffc107;
    font-size: 14px;
    color: #5a4a20;
    line-height: 1.65;
}
.interpret-empty-tip {
    margin-top: 10px;
    font-size: 12px;
    color: #8a7a50;
}
.interpret-empty-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #4A756F;
}

.loading { text-align: center; padding: 30px 0; }
.spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    border: 3px solid rgba(91, 140, 255, 0.15);
    border-top-color: #5B8CFF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { font-size: 14px; color: #5a6f84; }

/* 保存按钮 */
.save-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(91,140,255,0.12);
}
.save-msg {
    font-size: 12px;
    color: #4a756f;
    margin-right: auto;
}
.save-msg.ok { color: #27ae60; }
.btn-save {
    padding: 8px 20px;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #5B8CFF, #4ECDC4);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.btn-save:active { opacity: 0.8; }
.btn-records {
    padding: 8px 14px;
    border-radius: 20px;
    background: rgba(91,140,255,0.06);
    border: 1px solid rgba(91,140,255,0.2);
    color: #5B8CFF;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
}
.btn-records:active { background: rgba(91,140,255,0.15); }

/* 设备同步 */
.sync-panel {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px;
    margin: 12px 0;
    flex-wrap: wrap;
}
.sync-label { font-size: 13px; color: #4a5568; font-weight: 600; }
.sync-code {
    font-size: 22px; font-weight: 900; letter-spacing: 6px;
    color: #5B8CFF; background: rgba(91,140,255,0.1);
    padding: 6px 16px; border-radius: 10px; font-family: monospace;
}
.sync-input {
    width: 120px; padding: 8px 10px; border: 1px solid rgba(91,140,255,0.3);
    border-radius: 10px; font-size: 15px; text-align: center; letter-spacing: 4px;
    font-family: monospace; background: rgba(255,255,255,0.8);
}
.sync-input:focus { border-color: #5B8CFF; outline: none; }
.btn-sync, .btn-sync-bind {
    padding: 8px 16px; border: 1px solid rgba(91,140,255,0.3);
    border-radius: 20px; background: rgba(255,255,255,0.7);
    color: #4a5568; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn-sync:hover, .btn-sync-bind:hover { background: rgba(91,140,255,0.1); color: #5B8CFF; }
.btn-sync-bind { background: linear-gradient(135deg, #5B8CFF, #4ECDC4); color: #fff; border: none; }
.btn-sync-bind:hover { background: linear-gradient(135deg, #4ECDC4, #5B8CFF); color: #fff; }
.sync-msg { font-size: 12px; }
.sync-msg.ok { color: #27ae60; }
.sync-msg.err { color: #e74c3c; }

/* 首页 header 解卦记录按钮 */
.header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.btn-history {
    padding: 6px 14px;
    border-radius: 16px;
    background: rgba(91,140,255,0.08);
    border: 1px solid rgba(91,140,255,0.25);
    color: #5B8CFF;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.btn-history:active {
    background: rgba(91,140,255,0.18);
}

.btn-history-main {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, #5B8CFF, #4ECDC4);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity 0.2s;
}
.btn-history-main:active { opacity: 0.8; }

/* 限额提示条 */
.quota-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    margin-bottom: 12px;
    background: rgba(245,166,35,0.08);
    border: 1px solid rgba(245,166,35,0.2);
    border-radius: 10px;
    font-size: 13px;
    color: #b8731a;
}
.quota-bar.expired {
    background: rgba(231,76,60,0.08);
    border-color: rgba(231,76,60,0.2);
    color: #c0392b;
}
.quota-bar.dev {
    background: rgba(114,46,209,0.08);
    border-color: rgba(114,46,209,0.25);
    color: #722ed1;
}
.quota-icon { font-size: 16px; }

/* header-actions */
.header-actions { display: flex; align-items: center; gap: 8px; }
.btn-login {
    padding: 6px 14px;
    border-radius: 16px;
    background: rgba(114,46,209,0.08);
    border: 1px solid rgba(114,46,209,0.25);
    color: #722ed1;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.btn-login:active { background: rgba(114,46,209,0.18); }
.user-badge {
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(114,46,209,0.08);
    color: #722ed1;
    font-size: 12px;
    font-weight: 600;
}
.user-badge.dev {
    background: rgba(114,46,209,0.15);
    color: #531dab;
}
.btn-logout {
    padding: 6px 14px;
    border-radius: 16px;
    background: rgba(255,77,79,0.08);
    border: 1px solid rgba(255,77,79,0.25);
    color: #ff4d4f;
    font-size: 13px;
    text-decoration: none;
    cursor: pointer;
}
.btn-logout:active { background: rgba(255,77,79,0.18); }

/* 评论心得区域 */
.comment-section {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255,255,255,0.6);
    border-radius: 12px;
    border: 1px solid rgba(45,111,105,0.15);
}
.comment-title {
    font-size: 15px;
    font-weight: 600;
    color: #2f6f66;
    margin-bottom: 10px;
}
.comment-input {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1px solid rgba(45,111,105,0.2);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
    background: rgba(255,255,255,0.8);
    color: #1a2a3a;
}
.comment-input:focus {
    outline: none;
    border-color: #2f6f66;
    box-shadow: 0 0 0 2px rgba(47,111,102,0.1);
}
.comment-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}
.comment-count {
    font-size: 12px;
    color: #8899aa;
}
.btn-comment-save {
    padding: 6px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, #3a8f85 0%, #2f6f66 100%);
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-comment-save:active {
    background: linear-gradient(135deg, #2f6f66 0%, #256058 100%);
}
.btn-comment-save:disabled {
    background: #ccc;
    cursor: not-allowed;
}
.comment-msg {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #8899aa;
}
.comment-msg.ok {
    color: #1fa84f;
}
.comment-msg.error {
    color: #dd3e3e;
}

