/* __V3D_TEMPLATE__ - template-based file; delete this line to prevent this file from being updated */

html {
    height: 100%;
}

body {
    margin: 0px;
    overflow: hidden;
    min-height: 100%;
    /* 柔和多色过渡，适合低龄课件；WebGL 透明时从画布缝隙可见 */
    background: linear-gradient(
        155deg,
        #c8ecff 0%,
        #e8d8ff 28%,
        #ffeccb 58%,
        #d4f5e8 100%
    );
    background-attachment: fixed;
}

noscript {
    display: block;
    text-align: center;
    padding-top: 100px;
    font-size: 20px;
}

#v3d-container {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background: transparent;
}

.v3d-container {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
}

.fullscreen-button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 50px;
    height: 50px;
    cursor: pointer;
    background-size: 100% 100%;
    display: none;
    z-index: 1;
}

.fullscreen-open {
    background-image: url('media/fullscreen_open.svg');
}

.fullscreen-close {
    background-image: url('media/fullscreen_close.svg');
}

/* removes tap blinking on ios devices */
* { -webkit-tap-highlight-color:rgba(0,0,0,0); }

/* 周长课件覆盖层（在 3D 之上）；3D 未加载完前隐藏 */
#zhou-ui {
    position: fixed;
    inset: 0;
    z-index: 6;
    pointer-events: none;
    font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#zhou-ui.zhou-ui--hidden {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#zhou-svg {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: auto;
    touch-action: none;
}

/* 大屏触控 / 学生平板 / 教师演示：底部控件加大热区 + 刘海/横条安全区，避免贴边误触 */
.zhou-footer-stack {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 12;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    box-sizing: border-box;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.zhou-footer-stack .zhou-toolbar,
.zhou-footer-stack .zhou-answer-feedback-bar,
.zhou-footer-stack .zhou-hint-bar {
    pointer-events: auto;
}

.zhou-hint-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px max(12px, env(safe-area-inset-left, 0px)) 6px
        max(12px, env(safe-area-inset-right, 0px));
    background: rgba(255, 255, 255, 0.82);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
}

.zhou-hint-bar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    max-width: min(720px, 100%);
    text-align: center;
}

.zhou-perimeter {
    font-size: clamp(14px, 2.8vw, 17px);
    font-weight: 700;
    color: #1a4a6e;
    line-height: 1.35;
}

.zhou-perimeter.zhou-perimeter--warn {
    color: #c62828;
}

.zhou-hint {
    font-size: clamp(13px, 2.5vw, 16px);
    font-weight: 600;
    color: #2a4a62;
    line-height: 1.4;
}

.zhou-hint.zhou-hint--warn {
    color: #c62828;
}

.zhou-toolbar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 14px max(12px, env(safe-area-inset-left, 0px)) 12px
        max(12px, env(safe-area-inset-right, 0px));
    background: linear-gradient(to top, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72));
    box-sizing: border-box;
}

/* 单行内控件成组居中，换行时每行仍居中；避免宽屏上「左一堆、右一堆」 */
.zhou-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    box-sizing: border-box;
}

/* 作答反馈单独一行，输入与「确定」已并入 .zhou-toolbar */
.zhou-answer-feedback-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px max(12px, env(safe-area-inset-left, 0px)) 10px
        max(12px, env(safe-area-inset-right, 0px));
    background: rgba(255, 255, 255, 0.88);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-sizing: border-box;
    min-height: 0;
}

.zhou-answer-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.zhou-answer-input {
    width: 120px;
    min-width: 72px;
    max-width: 160px;
    flex: 1 1 100px;
    min-height: 48px;
    padding: 10px 12px;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #7eb8d6;
    box-sizing: border-box;
}

.zhou-answer-input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.zhou-answer-submit {
    min-width: 72px;
}

.zhou-answer-feedback {
    font-size: 15px;
    font-weight: 600;
    color: #2a7a4a;
    text-align: center;
    width: 100%;
    max-width: 560px;
    box-sizing: border-box;
}

/* 边长数字：两层 <text>（先 halo 后 core），避免 iOS Safari 在单层 text 上 fill+stroke 与父 g transform 叠加时填充丢失 */
.zhou-edge-len {
    font-size: 24px;
    font-weight: 800;
    pointer-events: none;
    user-select: none;
}

.zhou-edge-len--halo {
    fill: none;
    stroke: #ffffff;
    stroke-width: 5px;
    stroke-linejoin: round;
}

.zhou-edge-len--core {
    fill: #0a2540;
    stroke: none;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

.zhou-random-label-short {
    display: none;
}

@media (max-width: 420px) {
    .zhou-random-label-long {
        display: none;
    }

    .zhou-random-label-short {
        display: inline;
    }

    .zhou-toolbar {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .zhou-toolbar-row {
        gap: 8px;
    }
}

.zhou-anno-label {
    margin: 0;
    position: relative;
    z-index: 2;
    pointer-events: auto;
    flex: 0 1 min(220px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    min-width: 0;
    max-width: 100%;
}

.zhou-anno-select {
    min-height: 48px;
    padding: 10px 12px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    border: 2px solid #3d9ad6;
    background: #fff;
    color: #2a4a62;
    width: 100%;
    max-width: min(220px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
    box-sizing: border-box;
    cursor: pointer;
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

.zhou-anno-select:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.zhou-dir-picker {
    position: fixed;
    z-index: 40;
    pointer-events: auto;
    transform: translate(-50%, -50%);
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 12px;
    box-shadow: 0 4px 22px rgba(0, 0, 0, 0.18);
    border: 2px solid #b8dcef;
}

.zhou-dir-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 6px;
}

.zhou-dir-cell {
    width: 46px;
    height: 46px;
    padding: 4px;
    border: 2px solid #cfe8f7;
    border-radius: 8px;
    background: #f5fbff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zhou-dir-cell img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
}

.zhou-dir-cell:hover {
    border-color: #3d9ad6;
    background: #e8f6ff;
}

.zhou-dir-cell:active {
    transform: scale(0.95);
}

.zhou-edge.zhou-edge--pick .zhou-edge-line {
    stroke-width: 11;
}

.zhou-btn {
    pointer-events: auto;
    cursor: pointer;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    min-height: 48px;
    min-width: 48px;
    font-size: clamp(15px, 2.5vw, 17px);
    font-weight: 600;
    color: #fff;
    background: linear-gradient(180deg, #5eb8e8 0%, #3d9ad6 100%);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
}

.zhou-btn:disabled {
    cursor: not-allowed;
    color: rgba(255, 255, 255, 0.75);
    background: linear-gradient(180deg, #b0b8c4 0%, #8a93a0 100%);
    box-shadow: none;
    opacity: 0.85;
}

.zhou-btn:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: none;
}

.zhou-grid-line {
    stroke: rgba(255, 255, 255, 0.45);
    stroke-width: 1;
}

.zhou-draw-line {
    fill: none;
    stroke: rgba(46, 139, 192, 0.85);
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* 闭合前：预览与起点共行/共列时的穿屏虚线提示 */
.zhou-tracking-guides {
    pointer-events: none;
}

.zhou-tracking-guide {
    fill: none;
    stroke: rgba(46, 139, 192, 0.72);
    stroke-width: 2;
    stroke-dasharray: 8 12;
    stroke-linecap: round;
}

/* 画线时笔迹预览（从上一顶点到鼠标） */
.zhou-pen-preview {
    fill: none;
    stroke: rgba(30, 110, 180, 0.55);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 4 8;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
}

.zhou-vertex {
    fill: #ff9f43;
    stroke: #fff;
    stroke-width: 2;
}

.zhou-vertex.zhou-vertex--close-hint {
    fill: #27ae60;
    stroke: #fff;
    stroke-width: 3;
    filter: drop-shadow(0 0 10px rgba(39, 174, 96, 0.85));
}

.zhou-bbox {
    fill: none;
    stroke: rgba(180, 120, 220, 0.75);
    stroke-width: 2;
    stroke-dasharray: 10 8;
}

.zhou-edge-line {
    stroke: #2a7ab8;
    stroke-width: 6;
    stroke-linecap: round;
    pointer-events: none;
}

/* 透明加宽命中带，叠在最上层，便于手指拖边 / 点选（可见边线保持 pointer-events: none） */
.zhou-edge-hit {
    fill: none;
    stroke: rgba(0, 0, 0, 0.001);
    stroke-width: 24;
    stroke-linecap: round;
    pointer-events: stroke;
}

@media (pointer: coarse), (max-width: 900px) {
    .zhou-edge-line {
        stroke-width: 10;
    }

    .zhou-edge.zhou-edge--pick .zhou-edge-line {
        stroke-width: 15;
    }

    .zhou-edge-hit {
        stroke-width: 52;
    }

    .zhou-draw-line {
        stroke-width: 7;
    }

    .zhou-pen-preview {
        stroke-width: 8;
    }

    .zhou-edge-len {
        font-size: 27px;
    }

    .zhou-edge-len--halo {
        stroke-width: 6px;
    }
}

/* 拖动后留在原位的参考线 */
.zhou-ghost-line {
    fill: none;
    stroke: #b0b8c2;
    stroke-width: 5;
    stroke-linecap: round;
    opacity: 0.9;
    pointer-events: none;
}

/* 原边中点 → 移动后边中点的指引 */
.zhou-guide-line {
    fill: none;
    stroke: #6b7c8e;
    stroke-width: 2;
    stroke-dasharray: 7 6;
    pointer-events: none;
}

.zhou-arrow {
    pointer-events: none;
}

.zhou-edge {
    cursor: inherit;
}

.fullscreen-button {
    z-index: 20;
}


.v3d-simple-preloader-logo {
    background-image: url('media/logo180.png');
}
