/* 时间折叠小游戏样式 */

.tf-page {
    min-height: 100vh;
    padding: 24px 16px 40px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.58), transparent 34%),
        linear-gradient(180deg, #eef6ff 0%, #dff3ff 40%, #f4eaff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    box-sizing: border-box;
}

.tf-hero {
    width: min(1100px, 100%);
    text-align: center;
    padding: 18px 16px 8px;
}

.tf-badge {
    display: inline-block;
    padding: 8px 14px;
    border: 3px solid #111;
    background: #9fe8ff;
    color: #111;
    font-weight: 900;
    font-size: 14px;
    border-radius: 999px;
    box-shadow: 4px 4px 0 #111;
    margin-bottom: 14px;
}

.tf-hero h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 1.1;
    color: #111;
    text-shadow: 3px 3px 0 rgba(255, 255, 255, 0.85);
}

.tf-hero p {
    margin: 10px auto 0;
    max-width: 820px;
    color: #333;
    font-size: 16px;
    line-height: 1.75;
}

.tf-panel {
    width: min(1100px, 100%);
    border: 4px solid #111;
    background: #fff;
    box-shadow: 8px 8px 0 #111;
    border-radius: 22px;
    padding: 18px;
}

.tf-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.tf-stat {
    border: 3px solid #111;
    background: #f7fbff;
    border-radius: 16px;
    padding: 12px 10px;
    text-align: center;
    box-shadow: 4px 4px 0 #111;
}

.tf-stat .label {
    display: block;
    font-size: 13px;
    color: #444;
    margin-bottom: 8px;
    font-weight: 700;
}

.tf-stat .value {
    display: block;
    font-size: 28px;
    font-weight: 900;
    color: #111;
    line-height: 1;
}

.tf-stat .tf-small {
    font-size: 18px;
    line-height: 1.2;
}

.tf-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: stretch;
    margin-bottom: 16px;
}

.tf-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tf-fold-box {
    flex: 1 1 320px;
    border: 3px solid #111;
    border-radius: 18px;
    background: #f8fbff;
    padding: 14px 16px;
    box-shadow: 4px 4px 0 #111;
}

.tf-fold-box p {
    margin: 10px 0 0;
    color: #444;
    line-height: 1.6;
    font-size: 14px;
}

.tf-btn {
    border: 3px solid #111;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 800;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    box-shadow: 4px 4px 0 #111;
    font-size: 16px;
}

.tf-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 6px 6px 0 #111;
}

.tf-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #111;
}

.tf-btn.primary {
    background: #7cff6b;
    color: #111;
}

.tf-btn.secondary {
    background: #fff;
    color: #111;
}

.tf-btn.fold {
    width: 100%;
    background: #9fe8ff;
    color: #111;
}

.tf-btn.fold i {
    margin-right: 6px;
}

.tf-tips {
    border: 3px solid #111;
    border-radius: 18px;
    background: #f9fbff;
    padding: 14px 16px;
}

.tf-tips > span {
    display: inline-block;
    font-weight: 900;
    font-size: 14px;
    margin-bottom: 8px;
    background: #111;
    color: #fff;
    padding: 4px 10px;
    border-radius: 999px;
}

.tf-tips ul {
    margin: 8px 0 0;
    padding-left: 20px;
    color: #333;
    line-height: 1.7;
}

.tf-game {
    width: min(1100px, 100%);
    border: 4px solid #111;
    border-radius: 24px;
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 40%),
        linear-gradient(180deg, #d7f4ff 0%, #efe2ff 100%);
    box-shadow: 10px 10px 0 #111;
    padding: 18px;
}

.tf-hud {
    display: flex;
    justify-content: center;
    margin-bottom: 14px;
}

.tf-status {
    min-width: 220px;
    text-align: center;
    padding: 10px 16px;
    border: 3px solid #111;
    background: #fff;
    border-radius: 999px;
    font-weight: 900;
    box-shadow: 4px 4px 0 #111;
}

.tf-board-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 10px;
}

.tf-board {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    width: min(100%, 720px);
    aspect-ratio: 6 / 6;
}

.tf-cell {
    border: 3px solid #111;
    border-radius: 16px;
    background: linear-gradient(180deg, #f4f7ff 0%, #dfe9ff 100%);
    box-shadow: 4px 4px 0 #111;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    color: #111;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.tf-cell span {
    position: relative;
    z-index: 2;
    font-size: clamp(12px, 2vw, 18px);
}

.tf-cell::after {
    content: "";
    position: absolute;
    inset: 12%;
    border-radius: 12px;
    border: 2px dashed rgba(17, 17, 17, 0.12);
    pointer-events: none;
}

.tf-cell.start {
    background: linear-gradient(180deg, #fffbd8 0%, #ffe987 100%);
}

.tf-cell.wall {
    background: linear-gradient(180deg, #232533 0%, #111320 100%);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08), 4px 4px 0 #111;
}

.tf-cell.wall span {
    color: rgba(255, 255, 255, 0.0);
}

.tf-cell.plate {
    background: linear-gradient(180deg, #d5f7ff 0%, #65d7ff 100%);
}

.tf-cell.plate.pulse {
    animation: tf-pulse 1s infinite ease-in-out;
}

.tf-cell.door.closed {
    background: linear-gradient(180deg, #ffdfdf 0%, #ff8f8f 100%);
}

.tf-cell.door.open {
    background: linear-gradient(180deg, #d2ffe2 0%, #6ce18a 100%);
}

.tf-cell.exit {
    background: linear-gradient(180deg, #fff0b2 0%, #ffcb4d 100%);
}

.tf-cell.trail {
    background: linear-gradient(180deg, #f1f4ff 0%, #d5ddff 100%);
}

.tf-cell.echo {
    background: linear-gradient(180deg, #e5fbff 0%, #97efff 100%);
    box-shadow: 0 0 0 3px rgba(57, 183, 255, 0.2), 4px 4px 0 #111;
}

.tf-cell.player {
    background: linear-gradient(180deg, #fff3a1 0%, #ffb648 100%);
    transform: translate(-1px, -1px);
}

.tf-cell.player::before {
    content: "我";
    position: absolute;
    inset: auto auto 8px 8px;
    font-size: 12px;
    font-weight: 900;
    color: rgba(17, 17, 17, 0.65);
}

.tf-pad {
    display: grid;
    gap: 10px;
    justify-items: center;
    margin: 14px auto 0;
    width: min(320px, 100%);
}

.tf-pad-row {
    display: grid;
    grid-template-columns: 1fr 90px 1fr;
    gap: 10px;
    width: 100%;
}

.tf-pad-btn {
    width: 100%;
    min-height: 54px;
    border: 3px solid #111;
    border-radius: 14px;
    background: #fff;
    box-shadow: 4px 4px 0 #111;
    font-weight: 900;
    font-size: 18px;
    cursor: pointer;
}

.tf-pad-btn.center {
    background: #9fe8ff;
}

.tf-footer {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.tf-card {
    border: 3px solid #111;
    background: #fff;
    border-radius: 18px;
    padding: 14px 16px;
    box-shadow: 4px 4px 0 #111;
}

.tf-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: #111;
}

.tf-card p {
    margin: 0;
    color: #444;
    line-height: 1.7;
    font-size: 14px;
}

.tf-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.tf-overlay.show {
    display: flex;
}

.tf-result {
    width: min(420px, 100%);
    border: 4px solid #111;
    background: #fff;
    border-radius: 24px;
    box-shadow: 10px 10px 0 #111;
    text-align: center;
    padding: 28px 22px;
}

.result-emoji {
    font-size: 64px;
    margin-bottom: 8px;
}

.tf-result h2 {
    margin: 0 0 10px;
    font-size: 28px;
    color: #111;
}

.tf-result p {
    margin: 0 0 16px;
    font-size: 16px;
    color: #333;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

@keyframes tf-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@media (max-width: 900px) {
    .tf-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tf-footer {
        grid-template-columns: 1fr;
    }

    .tf-board {
        width: 100%;
        gap: 8px;
    }
}

@media (max-width: 640px) {
    .tf-page {
        padding: 16px 12px 32px;
    }

    .tf-panel,
    .tf-game,
    .tf-hero {
        box-shadow: 6px 6px 0 #111;
        border-radius: 18px;
    }

    .tf-board {
        gap: 6px;
    }

    .tf-stat .value {
        font-size: 24px;
    }

    .tf-btn {
        width: 100%;
        justify-content: center;
    }

    .tf-controls {
        flex-direction: column;
    }

    .tf-actions {
        width: 100%;
    }

    .tf-actions .tf-btn {
        width: 100%;
    }

    .tf-pad {
        width: min(100%, 300px);
    }
}

@media (max-width: 380px) {
    .tf-board {
        gap: 4px;
    }

    .tf-cell {
        border-radius: 12px;
    }
}
