/* =============================================
   파이프 연결 게임 스타일
   테마: 다크 + 시안 (#06B6D4)
   ============================================= */

html { background: #0f0f23; }

.pc-body {
    overflow: hidden;
    height: 100dvh;
    max-width: 480px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

.pc-game {
    width: 100%;
    height: 100dvh;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    position: relative;
    background: #0f0f23;
}

.pc-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    z-index: 10;
    flex-shrink: 0;
}
.pc-back {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}
.pc-back:hover { color: #fff; }
.pc-info-badge {
    font-size: 13px;
    font-weight: 600;
    color: #06B6D4;
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.pc-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 20px;
    overflow-y: auto;
}

/* ===== INTRO ===== */
.state-intro .pc-info-badge { display: none; }
.state-intro .pc-content {
    justify-content: center;
    padding-top: 0;
}

.pc-intro-emoji { font-size: 72px; margin-bottom: 16px; }
.pc-intro-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}
.pc-intro-desc {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
}
.pc-intro-desc strong { color: #06B6D4; }

.pc-best {
    background: rgba(6, 182, 212, 0.1);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.pc-challenge {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    padding: 10px 18px;
    margin-bottom: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.pc-rules {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}
.pc-rule-chip {
    padding: 6px 14px;
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 20px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.pc-btn-start {
    display: inline-block;
    padding: 16px 48px;
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.pc-btn-start:active { transform: scale(0.95); }

/* ===== PLAYING ===== */
.state-playing .pc-content {
    justify-content: flex-start;
    padding-top: 16px;
}

.pc-stage-info {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
}
.pc-stage-info strong { color: #06B6D4; }

.pc-moves-info {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
}
.pc-moves-info strong { color: #06B6D4; }

/* Grid */
.pc-grid {
    display: grid;
    gap: 4px;
    margin-bottom: 16px;
}

.pc-cell {
    position: relative;
    border-radius: 6px;
    cursor: pointer;
    background: #1e1e35;
    border: 2px solid #2d2d44;
    -webkit-tap-highlight-color: transparent;
    transition: border-color 0.2s;
}
.pc-cell:active { transform: scale(0.92); }
.pc-cell.pc-tapping {
    animation: pcTap 0.2s ease;
}
@keyframes pcTap {
    0% { transform: scale(1); }
    50% { transform: scale(0.88); }
    100% { transform: scale(1); }
}

/* START / END markers */
.pc-cell.pc-start {
    border-color: #22C55E;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.3);
}
.pc-cell.pc-end {
    border-color: #EF4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Pipe segments */
.pc-pipe {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
}

.pc-center {
    position: absolute;
    width: 40%;
    height: 40%;
    top: 30%;
    left: 30%;
    border-radius: 50%;
    background: #475569;
    transition: background 0.3s, box-shadow 0.3s;
}

.pc-seg {
    position: absolute;
    background: #475569;
    border-radius: 2px;
    transition: background 0.3s, box-shadow 0.3s;
}
.pc-seg-up {
    width: 40%;
    height: 35%;
    top: 0;
    left: 30%;
}
.pc-seg-right {
    width: 35%;
    height: 40%;
    top: 30%;
    right: 0;
}
.pc-seg-down {
    width: 40%;
    height: 35%;
    bottom: 0;
    left: 30%;
}
.pc-seg-left {
    width: 35%;
    height: 40%;
    top: 30%;
    left: 0;
}

/* Connected (flow) state */
.pc-cell.pc-connected .pc-center {
    background: #06B6D4;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
}
.pc-cell.pc-connected .pc-seg {
    background: #06B6D4;
    box-shadow: 0 0 6px rgba(6, 182, 212, 0.4);
}

/* START connected */
.pc-cell.pc-start.pc-connected .pc-center {
    background: #22C55E;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.6);
}
.pc-cell.pc-start.pc-connected .pc-seg {
    background: #22C55E;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

/* END connected */
.pc-cell.pc-end.pc-connected .pc-center {
    background: #EF4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}
.pc-cell.pc-end.pc-connected .pc-seg {
    background: #EF4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* Stage clear overlay */
.pc-clear-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 15, 35, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    animation: pcFadeIn 0.3s ease;
}
@keyframes pcFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.pc-clear-text {
    font-size: 32px;
    font-weight: 900;
    color: #06B6D4;
    margin-bottom: 12px;
}
.pc-clear-moves {
    font-size: 16px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 24px;
}
.pc-btn-next {
    padding: 14px 40px;
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}
.pc-btn-next:active { transform: scale(0.95); }

/* ===== RESULT ===== */
.state-result .pc-info-badge { display: none; }
.state-result .pc-content {
    justify-content: flex-start;
    padding-top: 24px;
}

/* Toast */
.pc-toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.pc-toast-show {
    opacity: 1;
    pointer-events: auto;
}

/* S/E label */
.pc-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: 900;
    z-index: 2;
    pointer-events: none;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.pc-start .pc-label { color: #22C55E; }
.pc-end .pc-label { color: #EF4444; }

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .pc-intro-title { font-size: 24px; }
    .pc-intro-emoji { font-size: 56px; }
}

@media (max-width: 360px) {
    .pc-top-bar { padding: 10px 12px; }
    .pc-content { padding: 12px 16px; }
    .pc-grid { gap: 3px; }
}
