/* ===== 全局：等宽字体 + 18px 基础字号 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Consolas, "Courier New", monospace;
    font-size: 18px;
}

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #fff;
}

/* ===== 主容器 PC 端：Grid 两列，右列分两行 ===== */
#container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    width: 100vw;
    height: 100vh;
}

#drawPanel {
    grid-column: 1;
    grid-row: 1 / 3;
    position: relative;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #fafafa;
}

#ctrlBar {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-bottom: 1px solid #ccc;
    background: #fff;
    font-size: 12.6px;
    min-width: 0;
}

#infoPanel {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
    height: 100%;
    padding: 12px;
    overflow: auto;
    border-left: 1px solid #ccc;
    min-width: 0;
    min-height: 0;
    background: #fff;
    font-size: 12.6px;
}

#cv {
    width: 100%;
    height: 100%;
    display: block;
}

#infoPanel h4 {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

#infoText {
    line-height: 1.5;
    color: #333;
    font-size: 12.6px;
}

#infoText pre {
    font-size: 12.6px;
    line-height: 1.45;
    white-space: pre-wrap;
    margin: 4px 0;
    color: #222;
}

#infoText .info-sec {
    margin: 4px 0;
}

#infoText .grey {
    color: #666;
    margin-top: 6px;
}

#infoText .red { color: #f00; font-weight: bold; }
#infoText .blue { color: #0055cc; font-weight: bold; }
#infoText .grey { color: #666; }
#infoText .p1 { color: #d82828; font-weight: bold; }
#infoText .p2 { color: #2878d8; font-weight: bold; }
#infoText .p3 { color: #28a848; font-weight: bold; }
#infoText .p4 { color: #9c27b0; font-weight: bold; }
#infoText .p5 { color: #ff9800; font-weight: bold; }

.info-title {
    margin-top: 4px;
    color: #0055cc;
    font-size: 13px;
}

.btn-rand {
    margin-left: 6px;
    padding: 1px 4px;
    font-size: 11px;
    color: #9c27b0;
    border-color: #9c27b0;
    background: #faf5fb;
}

.btn-rand:hover:not(:disabled) {
    background: #f0e0f5;
}

.btn-group {
    display: flex;
    flex-direction: row;
    gap: 6px;
}

.mode-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-group label {
    padding: 4px 6px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.15s;
}

.mode-group label:hover {
    background: #f0f0f0;
}

.mode-group input[type="radio"] {
    margin-right: 4px;
    cursor: pointer;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.param-group label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.param-group input[type="number"] {
    width: 70px;
    padding: 2px 4px;
    border: 1px solid #999;
    border-radius: 2px;
    font-family: inherit;
    font-size: 12.6px;
}

button {
    padding: 4px 10px;
    cursor: pointer;
    text-align: center;
    border: 1px solid #999;
    border-radius: 3px;
    background: #fafafa;
    font-family: inherit;
    font-size: 16px;
    transition: background 0.15s;
}

#ctrlBar button {
    padding: 3px 7px;
    font-size: 12.6px;
}

#ctrlBar .mode-group label,
#ctrlBar .param-group label {
    font-size: 12.6px;
    padding: 2px 4px;
}

#ctrlBar input[type="radio"] {
    width: 12px;
    height: 12px;
}

button:hover:not(:disabled) {
    background: #e8e8e8;
}

button:active:not(:disabled) {
    background: #d8d8d8;
}

button:disabled {
    color: #999;
    cursor: not-allowed;
    background: #f0f0f0;
}

#btnManual { color: #0055cc; border-color: #0055cc; background: #f0f6ff; }
#btnManual:hover:not(:disabled) { background: #e0eefc; }
#btnManual.btn-manual { color: #0055cc; border-color: #0055cc; }
#btnManual.btn-manual:hover:not(:disabled) { background: #e0eefc; }
#btnStart.btn-auto { color: #28a848; border-color: #28a848; }
#btnStart.btn-auto:hover:not(:disabled) { background: #e8f5e8; }
#btnPause { color: #ff9800; border-color: #ff9800; }
#btnPause:hover:not(:disabled) { background: #fff3e0; }
#btnReset.btn-reset { color: #d82828; border-color: #d82828; }
#btnReset.btn-reset:hover:not(:disabled) { background: #fce8e8; }
.mc-rs { color: #d82828 !important; border-color: #d82828 !important; background: #fce8e8 !important; }

#fisherLabel {
    position: absolute;
    top: 66%;
    left: 40px;
    z-index: 10;
    max-width: 45%;
    color: #fa0404;
    font-size: 12px;
    line-height: 1.35;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.95), 0 0 4px rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

#hintBar {
    position: absolute;
    top: 66%;
    right: 24px;
    z-index: 10;
    max-width: 45%;
    color: #0055cc;
    font-size: 12px;
    line-height: 1.35;
    text-align: right;
    pointer-events: none;
    text-shadow: 0 0 4px rgba(255, 255, 255, 0.95), 0 0 4px rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

#mobileTip {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    display: none;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.82);
    border: 1px solid #f8c0c0;
    border-radius: 3px;
    color: #d82828;
    font-size: 15px;
    line-height: 1.35;
    pointer-events: none;
    max-width: 40%;
}

#mobileCtrl {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    z-index: 15;
    display: none;
    flex-direction: row;
    gap: 6px;
    padding: 4px 6px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #bbb;
    border-radius: 4px;
    align-items: center;
    pointer-events: auto;
    max-width: 96vw;
    flex-wrap: wrap;
    justify-content: center;
}

.mc-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.mc-label {
    font-size: 5.5px;
    color: #666;
    min-width: 18px;
}

.mc-btn {
    border: 1px solid #999;
    background: #fafafa;
    border-radius: 1.5px;
    padding: 1.5px 3px;
    font-size: 5.5px;
    cursor: pointer;
    min-width: 14px;
    text-align: center;
}

.mc-btn:active {
    background: #e0e0e0;
}

.mc-go {
    background: #e8f5e8 !important;
    border-color: #28a848 !important;
    color: #28a848;
}

.mc-val {
    font-size: 5.5px;
    min-width: 25px;
    text-align: right;
    color: #222;
}

#watermark {
    position: fixed;
    right: 20px;
    bottom: 14px;
    z-index: 999;
    text-align: right;
    pointer-events: none;
    line-height: 1.5;
}

#homeLink {
    display: block;
    font-size: 12px;
    color: rgba(130, 130, 130, 0.8);
    text-decoration: none;
    pointer-events: auto;
    margin-bottom: 2px;
}

#homeLink:hover {
    color: rgba(40, 40, 40, 0.95);
    text-decoration: underline;
}

.wm-title {
    font-size: 15px;
    color: rgba(40, 40, 40, 0.78);
    font-weight: 600;
}

.wm-copy {
    font-size: 12px;
    color: rgba(130, 130, 130, 0.7);
    margin-top: 4px;
}

/* ===== 移动端竖屏 ===== */
@media (orientation:portrait) and (max-width:768px) {
    #container {
        grid-template-columns: 1fr;
        grid-template-rows: 55fr auto 45fr;
    }
    #drawPanel {
        grid-column: 1;
        grid-row: 1;
        position: relative;
    }
    #ctrlBar {
        grid-column: 1;
        grid-row: 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 6px 10px;
        padding: 6px 8px;
        border-bottom: 1px solid #ccc;
        border-left: none;
        background: #fff;
        font-size: 10px;
    }
    #ctrlBar .btn-group {
        flex-direction: row;
        gap: 4px;
    }
    #ctrlBar button {
        padding: 2px 5px;
        font-size: 10px;
    }
    #ctrlBar .mode-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px 6px;
    }
    #ctrlBar .mode-group label {
        font-size: 10px;
        padding: 1px 3px;
    }
    #ctrlBar .param-group {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 2px 6px;
    }
    #ctrlBar .param-group label {
        font-size: 10px;
    }
    #ctrlBar .param-group input[type="number"] {
        width: 50px;
        font-size: 10px;
        padding: 1px 2px;
    }
    .btn-rand {
        font-size: 9px;
        padding: 1px 3px;
    }
    #infoPanel {
        grid-column: 1;
        grid-row: 3;
        border-left: none;
        border-top: 1px solid #ccc;
        padding: 6px 6px 36px 6px;
        overflow: auto;
    }
    #infoPanel h4.info-title {
        font-size: 11px;
        margin-bottom: 8px;
    }
    #infoText {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-auto-flow: row;
        gap: 2px 8px;
        font-size: 10px;
        line-height: 1.3;
    }
    #infoText pre.info-sec {
        font-size: 10px;
        line-height: 1.3;
        white-space: pre-wrap;
        margin: 0;
    }
    #infoText .info-tip {
        grid-column: 1 / -1;
        font-size: 10px;
        margin-top: 2px;
    }
    #infoText .red, #infoText .blue,
    #infoText .p1, #infoText .p2, #infoText .p3, #infoText .p4, #infoText .p5 {
        font-size: 10px;
        font-weight: bold;
    }
    #fisherLabel {
        font-size: 8px;
        top: 66%;
        left: 10px;
        max-width: 48%;
    }
    #hintBar {
        font-size: 8px;
        top: 66%;
        right: 8px;
        max-width: 48%;
    }
    #mobileTip {
        display: block !important;
        top: 6px;
        right: 6px;
        font-size: 10px;
        max-width: 45%;
        padding: 4px 6px;
    }
    #mobileCtrl {
        display: none !important;
    }
    #watermark {
        right: 4px;
        bottom: 4px;
    }
    .wm-title { font-size: 9px; }
    .wm-copy, #homeLink { font-size: 7px; }
}
