* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #f0f2f5;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    color: #1a1a2e;
    cursor: default;
}

#canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

#canvas-container canvas {
    display: block;
}

/* Thread trail canvas */
#thread-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 30px;
    transition: opacity 0.6s ease;
}

#overlay.fade-out {
    opacity: 0;
}

.title {
    font-size: clamp(1.2rem, 5vw, 3rem);
    font-weight: 200;
    letter-spacing: clamp(0.3rem, 2vw, 1.2rem);
    text-transform: uppercase;
    background: linear-gradient(135deg, #0077b6, #7b2ff7, #e0218a);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    margin-bottom: 12px;
}

.subtitle {
    font-size: clamp(0.55rem, 2vw, 1rem);
    font-weight: 300;
    letter-spacing: clamp(0.1rem, 1vw, 0.4rem);
    color: rgba(26, 26, 46, 0.4);
}

/* Detail Panel */
#detail-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    background: rgba(240, 242, 245, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

#detail-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(1.05);
}

#back-btn {
    position: absolute;
    top: 40px;
    left: 40px;
    background: none;
    border: 1px solid rgba(26, 26, 46, 0.2);
    color: #1a1a2e;
    padding: 10px 24px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
    letter-spacing: 0.1rem;
}

#back-btn:hover {
    border-color: #0077b6;
    color: #0077b6;
    box-shadow: 0 0 20px rgba(0, 119, 182, 0.15);
}

#detail-content {
    max-width: 600px;
    text-align: center;
    padding: 40px;
}

#detail-title {
    font-size: 2.5rem;
    font-weight: 300;
    margin-bottom: 24px;
    background: linear-gradient(135deg, #0077b6, #7b2ff7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#detail-description {
    font-size: 1.1rem;
    line-height: 1.8;
    color: rgba(26, 26, 46, 0.65);
    margin-bottom: 32px;
}

#detail-tech {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

#detail-tech span {
    padding: 6px 16px;
    border: 1px solid rgba(123, 47, 247, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: rgba(26, 26, 46, 0.55);
    letter-spacing: 0.05rem;
}

#detail-link {
    display: inline-block;
    padding: 14px 40px;
    background: linear-gradient(135deg, #7b2ff7, #0077b6);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 1rem;
    letter-spacing: 0.1rem;
    transition: all 0.3s ease;
}

#detail-link:hover {
    box-shadow: 0 4px 30px rgba(0, 119, 182, 0.25), 0 0 60px rgba(123, 47, 247, 0.15);
    transform: translateY(-2px);
}

/* Tooltip */
#tooltip {
    position: fixed;
    z-index: 5;
    pointer-events: none;
    padding: 8px 18px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(0, 119, 182, 0.3);
    border-radius: 6px;
    color: #1a1a2e;
    font-size: 0.9rem;
    letter-spacing: 0.08rem;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08), 0 0 15px rgba(0, 119, 182, 0.08);
}

#tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Face Labels - always visible when front-facing */
#face-labels {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    overflow: hidden;
}

.face-label {
    position: absolute;
    pointer-events: none;
    white-space: nowrap;
    color: rgba(26, 26, 46, 0.9);
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(0, 119, 182, 0.2);
    border-radius: 4px;
    padding: 4px 10px;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    transform: translate(-50%, -50%);
    transition: opacity 0.25s ease;
    opacity: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.3;
}

.face-label-ja {
    font-size: 0.55rem;
    font-weight: 500;
    color: rgba(26, 26, 46, 0.55);
    letter-spacing: 0.04rem;
}

.face-label-en {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06rem;
}

/* Estimate Button */
#estimate-btn {
    position: fixed;
    bottom: clamp(18px, 4vh, 36px);
    right: clamp(18px, 3vw, 36px);
    z-index: 5;
    padding: clamp(5px, 1vh, 9px) clamp(10px, 2vw, 20px);
    font-size: clamp(0.48rem, 1.3vw, 0.67rem);
    font-weight: 500;
    letter-spacing: clamp(0.03rem, 0.2vw, 0.05rem);
    color: #fff;
    background: linear-gradient(135deg, #0077b6, #7b2ff7);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 119, 182, 0.3), 0 0 30px rgba(123, 47, 247, 0.1);
    transition: all 0.3s ease;
}

#estimate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(0, 119, 182, 0.4), 0 0 40px rgba(123, 47, 247, 0.2);
}

#estimate-btn:active {
    transform: translateY(0);
}
