:root {
    --bg-color: #f0f2f5;
    --text-main: #2d3748;
    --accent: #ff6b6b;
    --nav-bg: #ffffff;
    --nav-active: #ff6b6b;
    --nav-inactive: #a0aec0;
    --font-main: 'Inter', 'Noto Sans JP', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.hidden {
    display: none !important;
}

body {
    background-color: var(--bg-color);
    font-family: var(--font-main);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app {
    position: relative;
    width: 100%;
    max-width: 480px; 
    height: 96vh; /* Fit within viewport better */
    max-height: 850px; /* Constrain vertical for tall screens */
    margin: auto; /* Center vertically if vh > max-height */
    background-color: #fdfbf7;
    background-image: 
        radial-gradient(#cbd5e1 1px, transparent 1px);
    background-size: 20px 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    border-radius: 12px; /* Slight rounding for app-like fee */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Screen visibility and Page Turn Transition */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding-left: 65px; /* Side nav space */
    
    /* Global Notebook Background */
    background-color: #fdfbf7;
    background-image: 
        linear-gradient(90deg, transparent 79px, #abced4 79px, #abced4 81px, transparent 81px),
        repeating-linear-gradient(transparent, transparent 28px, #e2e8f0 28px, #e2e8f0 30px);
    background-size: 100% 100%, 100% 30px;
}

.screen.active {
    opacity: 1;
    pointer-events: auto;
    z-index: 10;
}

/* Page Turn Animation Classes */
.page-turn-exit {
    animation: pageTurnExit 0.6s ease-in-out forwards;
    z-index: 20 !important;
}

.page-turn-enter {
    animation: pageTurnEnter 0.6s ease-in-out forwards;
    z-index: 10 !important;
}

@keyframes pageTurnExit {
    0% { transform: translateX(0) scale(1) rotateY(0); opacity: 1; transform-origin: left center; }
    100% { transform: translateX(-110%) scale(0.9) rotateY(-20deg); opacity: 0; transform-origin: left center; }
}

@keyframes pageTurnEnter {
    0% { transform: translateX(100%) scale(0.9) rotateY(20deg); opacity: 0; transform-origin: left center; }
    100% { transform: translateX(0) scale(1) rotateY(0); opacity: 1; transform-origin: left center; }
}

/* Play Screen specific */
#view-play {
    padding-bottom: 0;
    padding-left: 0;
    background-color: #fdfbf7;
    position: relative;
}

/* Paper & Pencil style Header */
/* 1. Top Header Area (Arch Down) */
.game-header-v3 {
    width: 100%;
    height: 140px;
    background: #fdfbf7;
    border-bottom: 2px solid #e2e8f0;
    border-radius: 0 0 50% 50% / 0 0 45px 45px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 20px 40px;
    z-index: 200;
    position: relative;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.header-left, .header-right {
    flex: 0 0 60px;
    display: flex;
    justify-content: center;
}

.header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* 2. Central Play Area */
#game-canvas-area {
    position: relative;
    flex: 1;
    width: 100%;
    background: #fff;
    overflow: hidden;
    z-index: 10;
}

/* 3. Bottom Footer Area (Arch Up) */
.game-footer-v3 {
    width: 100%;
    height: 150px;
    background: #fdfbf7;
    border-top: 2px solid #e2e8f0;
    border-radius: 50% 50% 0 0 / 45px 45px 0 0;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 30px;
    z-index: 200;
    position: relative;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.05);
}

.paper-label-circle {
    width: 50px;
    height: 50px;
    background: #fff;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
    position: relative;
}

#time {
    font-size: 1.5rem;
    font-weight: 400;
    color: #5a5a5a;
    font-family: 'Gochi Hand', cursive;
}

.paper-label-score {
    background: #fef08a; /* Yellow sticker */
    padding: 5px 20px;
    min-width: 120px;
    text-align: center;
    box-shadow: 2px 4px 10px rgba(0,0,0,0.05);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
}
.paper-label-score small {
    font-size: 0.6rem;
    color: #854d0e;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
}
#score {
    font-size: 1.6rem;
    font-family: 'Gochi Hand', cursive;
    color: #4a4a4a;
}

.paper-label-coin {
    font-family: 'Gochi Hand', cursive;
    font-size: 1.1rem;
    color: #92400e;
    margin-top: 4px;
}

.pause-btn-paper {
    width: 42px;
    height: 42px;
    background: #fff;
    border: 1.5px solid #cbd5e1;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    font-weight: 900;
    color: #4a5568;
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.pause-content {
    background: #fff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    transform: rotate(-2deg);
    border: 2px solid #4a5568;
}

.pause-content h2 {
    font-size: 3rem;
    font-weight: 900;
    color: #4a5568;
    margin-bottom: 10px;
    font-family: 'Courier New', Courier, monospace;
}

.pause-content p {
    font-weight: 700;
    color: #718096;
}

/* Skill Button Positioning (Keep design but adjust context if needed) */
#skill-btn-wrapper-v2 {
    position: absolute;
    bottom: 30px;
    left: 40px;
    width: 90px;
    height: 90px;
    z-index: 300;
}

.skill-btn-circle {
    width: 80px;
    height: 80px;
    background: #fff;
    border: 3px solid #cbd5e1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
    padding: 0;
    z-index: 10;
}

.skill-btn-circle img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    pointer-events: none;
}

.skill-gauge-container {
    position: absolute;
    top: -5px; left: -5px;
    width: 90px; height: 90px;
    border-radius: 50%;
    border: 4px solid #e2e8f0;
    pointer-events: none;
    z-index: 5;
}

.skill-gauge-fill {
    position: absolute;
    bottom: 0; left: 0; width: 100%;
    background: #fde047;
    opacity: 0.6;
    transition: height 0.3s ease;
}

#game-canvas { display: block; width: 100%; height: 100%; }
#effects-layer { 
    position: absolute; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    pointer-events: none; 
    z-index: 150; 
}

.pencil-trace {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4a5568;
    border-radius: 50%;
    filter: blur(2px);
    opacity: 0.6;
    pointer-events: none;
    z-index: 170;
}

.flying-coin {
    position: absolute;
    width: 24px;
    height: 24px;
    background: #fde047; /* Bright yellow sticker */
    border: 2px solid #ca8a04;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 900;
    color: #ca8a04;
    font-size: 14px;
    font-family: 'Gochi Hand', cursive;
    pointer-events: none;
    z-index: 180;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.1);
}

.flying-coin::after {
    content: 'C';
}

/* Home Screen */
.home-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    background: transparent; /* Shared background from .screen */
}

.game-logo {
    font-size: 3.5rem;
    font-weight: 900;
    color: #1a202c;
    margin-bottom: 25px;
    position: relative;
    display: inline-block;
}
.game-logo span {
    background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 0px rgba(255,255,255,0.8));
    letter-spacing: -0.05em;
    position: relative;
}
/* Gold pen-tip underlining or accent */
.game-logo::after {
    content: '';
    position: absolute;
    bottom: 22px;
    left: 10%;
    width: 80%;
    height: 3px;
    background: linear-gradient(to right, transparent, #ca8a04, transparent);
    border-radius: 50%;
}
.game-logo small {
    display: block;
    font-size: 0.9rem;
    letter-spacing: 0.25em;
    font-weight: 800;
    color: #718096;
    margin-top: -5px;
    text-transform: uppercase;
}

.user-stats {
    background: white;
    padding: 15px 30px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 40px;
    font-weight: 700;
    color: #4a5568;
}

.user-stats p { margin: 5px 0; }

.home-center-visual {
    width: 100%;
    height: 150px;
    position: relative;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.floating-icon {
    width: 80px;
    height: 80px;
    position: absolute;
    animation: float 3s ease-in-out infinite alternate;
    border-radius: 50%;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}
.floating-icon:nth-child(1) { left: 50%; transform: translateX(-50%) translateY(-20px); z-index: 2; width: 100px; height: 100px;}
.floating-icon.delay-1 { left: 20%; animation-delay: 0.5s; width: 70px; height: 70px; }
.floating-icon.delay-2 { right: 20%; animation-delay: 1s; width: 60px; height: 60px;}

.floating-icon.main-equipped {
    position: static;
    width: 120px;
    height: 120px;
    animation: floatBig 3s ease-in-out infinite alternate;
}

@keyframes floatBig {
    0% { transform: translateY(0) scale(1.0); }
    100% { transform: translateY(-15px) scale(1.1); }
}

/* Paper Style Buttons */
.paper-btn {
    background-color: #fdfbf7;
    background-image: repeating-linear-gradient(
        transparent,
        transparent 14px,
        #f1f5f9 14px,
        #cbd5e1 15px
    );
    color: #4a5568;
    font-size: 1.2rem;
    font-weight: 900;
    padding: 10px 25px;
    border: 2px solid #a0aec0;
    border-radius: 4px;
    box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
    cursor: pointer;
    transition: all 0.1s;
    position: relative;
    letter-spacing: 0.05em;
    font-family: inherit;
    /* Add slight tilt for playfulness */
    transform: rotate(-1deg);
    z-index: 10;
}

/* Notebook tape effect */
.paper-btn::after {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(2deg);
    width: 30px;
    height: 12px;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.paper-btn:active {
    transform: rotate(-1deg) translate(2px, 2px);
    box-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

.paper-btn.primary-size {
    font-size: 1.5rem;
    padding: 15px 50px;
}

.paper-btn:disabled, .paper-btn.disabled {
    background-color: #f1f5f9;
    background-image: none;
    color: #cbd5e1;
    border-color: #e2e8f0;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.paper-btn:disabled::after, .paper-btn.disabled::after {
    display: none;
}

/* Scrollable Content */
.screen-header {
    background: white;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    z-index: 5;
}
.screen-header h2 { font-size: 1.2rem; font-weight: 800; color: var(--text-main); }

.scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Character Grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.char-card {
    background: white;
    border-radius: 15px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    text-align: center;
}

.char-card img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.char-card.equipped {
    border: 2px solid var(--accent);
    background: #fff5f5;
}

.char-card .name { font-size: 0.8rem; font-weight: 700; color: #4a5568; margin-bottom: 5px; }

.card-action {
    margin-top: auto;
    width: 100%;
}
.equip-btn {
    width: 100%;
    padding: 5px;
    border: none;
    border-radius: 10px;
    background: #4fd1c5;
    color: white;
    font-weight: 700;
    font-size: 0.7rem;
    cursor: pointer;
}
.equip-btn.disabled {
    background: #cbd5e1;
    cursor: default;
}
.lock-icon { font-size: 1.2rem; }

/* Shop Layout (Updated to light notebook) */
.shop-layout {
    background: transparent; /* Use shared notebook bg */
    padding-left: 65px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.shop-header {
    height: 60px;
    padding: 10px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    z-index: 20;
}

.currency-group {
    display: flex;
    gap: 10px;
}

.currency-item {
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #93c5fd;
    padding: 5px 12px;
    border-radius: 20px;
    color: white;
    font-weight: 800;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.shop-main-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-bottom: 20px;
    position: relative;
}

.gacha-box-visual {
    margin-bottom: 20px;
    animation: float 4s ease-in-out infinite alternate;
}

.gacha-box-container {
    width: 180px;
    height: 180px;
    background: #fef08a; /* Sticky note yellow */
    border: 4px solid #ca8a04;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    position: relative;
}

.box-emoji {
    font-size: 5rem;
    z-index: 2;
}

.gacha-info {
    text-align: center;
    color: #2d3748; /* Dark text for light background */
    margin-bottom: 20px;
}

.gacha-info h3 {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 5px;
}

.gacha-price-tag {
    font-size: 1.2rem;
    font-weight: 800;
    color: #f6ad55;
}

.shop-footer {
    height: 180px;
    background: rgba(255, 255, 255, 0.5); /* Semi-transparent white */
    border-top: 2px dashed #abced4;
    display: flex;
    flex-direction: column;
}

.shop-tabs {
    display: flex;
    height: 48px; /* Slightly taller for tabs */
}

.shop-tab {
    flex: 1;
    background: #e2e8f0;
    border: none;
    border-right: 1px solid #cbd5e1;
    color: #64748b;
    font-weight: 800;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.shop-tab.active {
    background: #fef08a; /* Yellow pad like home screen active nav */
    color: #854d0e;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.shop-carousel-container {
    flex: 1;
    overflow-x: auto;
    padding: 10px;
    scrollbar-width: none;
}
.shop-carousel-container::-webkit-scrollbar { display: none; }

.shop-carousel {
    display: flex;
    gap: 15px;
    padding: 0 10px;
    height: 100%;
}

.carousel-item {
    flex-shrink: 0;
    width: 100px;
    height: 110px;
    background: #fdfbf7;
    border: 3px solid #cbd5e1;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.carousel-item.active {
    border-color: #ca8a04;
    background: #fef08a;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.carousel-emoji { font-size: 2.5rem; margin-bottom: 5px; }
.carousel-name { font-size: 0.6rem; font-weight: 800; color: #4a5568; text-align: center; }

/* Draw Overlay */
#gacha-draw-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255, 255, 255, 0.9);
    z-index: 100;
    padding-left: 65px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#btn-cancel-draw { margin-top: 20px; }

/* Confirmation Modal */
.overlay-blur {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 150;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-left: 65px;
    backdrop-filter: blur(3px);
}

.sticky-note {
    background: #fef08a;
    width: 280px;
    padding: 30px;
    border-radius: 2px;
    box-shadow: 5px 10px 30px rgba(0,0,0,0.3);
    transform: rotate(1deg);
    text-align: center;
    position: relative;
}

.sticky-note::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(0,0,0,0.05);
}

.confirm-content h3 { font-size: 1.5rem; margin-bottom: 20px; color: #854d0e; }
.confirm-content p { font-weight: 700; color: #451a03; margin-bottom: 10px; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; margin-top: 25px; }

.paper-btn.secondary {
    background-image: none;
    background-color: #f1f5f9;
    border-color: #cbd5e1;
    color: #64748b;
}

.paper-btn.small {
    font-size: 0.8rem;
    padding: 5px 15px;
}

/* Side Navigation */
#side-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    left: 0;
    width: 65px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 50;
    transition: all 0.3s;
}

.sticky-tab {
    background-color: #fdfbf7;
    background-image: repeating-linear-gradient(transparent, transparent 4px, #e2e8f0 4px, #e2e8f0 5px);
    border: 2px solid #cbd5e1;
    border-left: none;
    border-radius: 0 10px 10px 0;
    padding: 15px 5px;
    box-shadow: 3px 3px 5px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s;
    
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #4a5568;
    font-weight: 800;
    font-size: 0.65rem;
    position: relative;
    transform-origin: left center;
}

.sticky-tab.active {
    background-color: #fef08a;
    width: 75px;
    color: #854d0e;
    border-color: #ca8a04;
    box-shadow: 4px 4px 5px rgba(0,0,0,0.15);
}

.sticky-tab .nav-icon {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.portfolio-back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: white;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 100;
}

/* Animations */
.explosion-effect {
    position: absolute; border-radius: 50%; animation: expandFade 0.4s ease-out forwards; transform-origin: center;
}
.line-effect {
    position: absolute; background: rgba(255, 255, 255, 0.8); box-shadow: 0 0 10px rgba(255,255,255,0.8); animation: expandFade 0.3s ease-out forwards;
}

@keyframes expandFade {
    0% { transform: scale(0.5); opacity: 1; }
    100% { transform: scale(2); opacity: 0; }
}

/* Additions for Gacha and Coins */
.top-status-bar {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    z-index: 50;
    color: #f6ad55;
    font-size: 1.1rem;
}

.char-card.locked img {
    filter: brightness(0) opacity(0.2);
}
.char-card.locked .name {
    color: #a0aec0;
}

.notebook-canvas-container {
    width: 100%;
    margin-top: 20px;
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    height: 300px;
    background-image: repeating-linear-gradient(transparent, transparent 28px, #e2e8f0 28px, #e2e8f0 30px);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.02);
}

#gacha-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

.notebook-hint {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 0.8rem;
    color: #cbd5e1;
    pointer-events: none;
    font-weight: 700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

#gacha-result-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(255,255,255,0.95);
    z-index: 100;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s;
    backdrop-filter: blur(5px);
}

#gacha-result-overlay.hidden {
    display: none !important;
}

#gacha-result-img {
    width: 150px; height: 150px;
    margin: 30px 0;
    animation: popBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popBounce {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

#gacha-result-title {
    font-size: 2.5rem; color: var(--accent); font-weight: 900;
    text-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
}

#gacha-result-name {
    font-size: 1.5rem; font-weight: 800; margin-bottom: 40px; color: var(--text-main);
}

/* Skill Knock Button (Rubber Knock) */
#skill-btn-wrapper {
    position: absolute;
    bottom: 20px;
    left: 20px; /* 左下に配置 */
    width: 80px;
    height: 150px;
    z-index: 50;
    pointer-events: none;
}

.skill-gauge-container {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: 3px solid #ccc;
    overflow: hidden;
    z-index: 51;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.skill-gauge-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, #ff9800, #ffeb3b);
    transition: height 0.3s ease;
    box-shadow: 0 0 10px rgba(255,235,59,0.8);
}

.knock-btn {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 90px;
    background: transparent;
    border: none;
    z-index: 52;
    pointer-events: auto;
    cursor: pointer;
    outline: none;
}

/* Rubber knock top (蛇腹グラデーション) */
.knock-top {
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 38px;
    height: 60px;
    background-color: #2c2c2c;
    background-image: repeating-linear-gradient(
        to bottom,
        #1a1a1a,
        #1a1a1a 4px,
        #3a3a3a 4px,
        #3a3a3a 8px
    );
    border-radius: 5px 5px 0 0;
    border: 2px solid #111;
    border-bottom: none;
    transition: top 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: inset 2px 0 5px rgba(255,255,255,0.1), inset -2px 0 5px rgba(0,0,0,0.8);
    color: transparent; /* "カチッ"文字を見えなくするか、あるいは外に置く */
}

/* Smooth Base representing the bottom part of the pen knock */
.knock-base {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 46px;
    height: 35px;
    background: linear-gradient(to right, #2a2a2a, #4a4a4a, #2a2a2a);
    border-radius: 2px 2px 0 0;
    border: 2px solid #111;
    border-bottom: none;
    box-shadow: 0 5px 10px rgba(0,0,0,0.3);
}

.knock-icon-img {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px; height: 30px;
    z-index: 53;
}
.knock-icon-img img {
    width: 100%; height: 100%; object-fit: cover; border-radius: 50%; border: 1px solid #555;
}

/* Enabled state */
.knock-btn:not([disabled]) .knock-top {
    top: -10px; /* Pops up ready to be pressed */
    background-color: #d97706; /* Glow active rubber */
    background-image: repeating-linear-gradient(
        to bottom,
        #b45309,
        #b45309 4px,
        #ea580c 4px,
        #ea580c 8px
    );
    border-color: #9a3412;
    box-shadow: 0 -5px 15px rgba(234,88,12,0.6), inset 2px 0 5px rgba(255,255,255,0.3), inset -2px 0 5px rgba(0,0,0,0.5);
}

.knock-btn:not([disabled]):active .knock-top {
    top: 15px; /* Push down firmly */
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
    background-image: repeating-linear-gradient(
        to bottom,
        #b45309,
        #b45309 2px,
        #ea580c 2px,
        #ea580c 4px /* compress height when pressed */
    );
}

/* In-game special skill effects */
.skill-cutin {
    position: absolute;
    top: 50%; left: 0; width: 100%;
    transform: translateY(-50%) scaleY(0);
    background: #fff;
    color: #1a202c;
    text-align: center;
    padding: 30px 0;
    z-index: 200;
    font-size: 2.2rem;
    font-weight: 900;
    animation: cutin 1.5s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Torn paper effect edge */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    clip-path: polygon(
        0% 5%, 5% 0%, 15% 7%, 25% 1%, 35% 8%, 45% 2%, 55% 9%, 65% 3%, 75% 10%, 85% 1%, 95% 8%, 100% 4%,
        100% 95%, 95% 100%, 85% 93%, 75% 99%, 65% 92%, 55% 100%, 45% 91%, 35% 98%, 25% 90%, 15% 100%, 5% 92%, 0% 98%
    );
    border-top: 2px dashed #cbd5e1;
    border-bottom: 2px dashed #cbd5e1;
}

@keyframes cutin {
    0% { transform: translateY(-50%) scaleY(0); letter-spacing: -10px; opacity: 0;}
    20% { transform: translateY(-50%) scaleY(1); letter-spacing: 5px; opacity: 1;}
    80% { transform: translateY(-50%) scaleY(1); letter-spacing: 10px; opacity: 1;}
    100% { transform: translateY(-50%) scaleY(0); letter-spacing: 20px; opacity: 0;}
}

/* MySta Screen (Updated to light notebook) */
.ts-layout {
    display: flex;
    flex-direction: column;
    background: transparent; /* Use shared notebook bg */
}

.character-detail-area {
    background: rgba(255, 255, 255, 0.4);
    padding: 15px;
    height: 45%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    border-bottom: 2px dashed #abced4;
    position: relative;
    color: #2d3748; /* Dark text */
}

.detail-icon {
    width: 100px;
    height: 100px;
    background: white;
    border: 3px solid #cbd5e1;
    border-radius: 20px;
    padding: 5px;
    margin-bottom: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.detail-info {
    text-align: center;
}

.detail-info h2 { font-size: 1.5rem; font-weight: 900; margin-bottom: 2px; }
.detail-info span { font-size: 0.8rem; color: #718096; font-weight: 700;}

.detail-skill-desc {
    margin: 15px 0;
    background: #fff;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    max-width: 90%;
    font-size: 0.85rem;
    font-weight: 700;
    color: #4a5568;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.detail-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.detail-icon {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 5px;
    margin-bottom: 5px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.detail-icon img {
    width: 100%; height: 100%; object-fit: contain; border-radius: 15px;
}

.detail-info {
    text-align: center;
    margin-bottom: 10px;
}

.detail-info h2 {
    font-size: 1.2rem;
    font-weight: 900;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    margin: 0;
}

.detail-info #detail-char-series {
    font-size: 0.75rem;
    color: #cbd5e1;
    font-weight: 700;
}

.detail-skill-desc {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 8px 30px 8px 15px;
    width: 90%;
    position: relative;
    margin-bottom: 15px;
}

.detail-skill-desc p {
    font-size: 0.85rem;
    font-weight: 800;
    line-height: 1.3;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    margin: 0;
}

.warning-icon {
    position: absolute;
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px; height: 24px;
    background: #f6ad55;
    color: white;
    border-radius: 50%;
    font-weight: 900;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.detail-stats {
    width: 90%;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 800;
}

.stat-label {
    width: 110px; text-align: right; margin-right: 10px;
    display: flex; justify-content: space-between; text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}
.stat-num { font-size: 0.95rem; }

.progress-bar-bg {
    flex: 1;
    height: 15px;
    background: #2d3748;
    border-radius: 10px;
    border: 2px solid #1a202c;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to bottom, #4fd1c5, #319795);
    border-radius: 8px;
    box-shadow: inset 0 2px 5px rgba(255,255,255,0.3);
}
.progress-bar-fill.skill {
    background: linear-gradient(to bottom, #f6ad55, #dd6b20);
}

.stat-max, .stat-ratio { width: 40px; text-align: center; margin-left: 5px; text-shadow: 1px 1px 2px rgba(0,0,0,0.8); }

.stat-footer-info {
    font-size: 0.8rem; font-weight: 700; text-align: right; color: #cbd5e1; margin-top: 5px; padding-right: 40px; text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.character-bottom-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #e2e8f0;
    overflow: hidden;
}

.character-list-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.list-header {
    background: #cbd5e1;
    padding: 8px 15px;
    font-size: 0.85rem;
    font-weight: 900;
    color: #4a5568;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #a0aec0;
}

.page-dots {
    display: flex;
    gap: 6px;
}
.page-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #8fa0b5; transition: all 0.3s;
}
.page-dot.active { background: #4a5568; transform: scale(1.2); }

.horizontal-scroll-container {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.horizontal-scroll-container::-webkit-scrollbar {
    display: none;
}

.char-page {
    min-width: 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: center;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 12px;
    padding: 15px;
    align-content: start;
}

.empty-slot {
    background: rgba(0,0,0,0.05);
    border-radius: 15px;
    border: 2px dashed rgba(0,0,0,0.1);
}

.ts-layout .char-card {
    padding: 10px; cursor: pointer; border: 4px solid transparent; transition: all 0.2s; position: relative;
    height: 100%;
}
.ts-layout .char-card.selected {
    border-color: #f6ad55; background: #fffaf0; box-shadow: 0 0 15px rgba(246, 173, 85, 0.5); transform: scale(1.05); z-index: 2;
}
.ts-layout .char-card.equipped-mark::after {
    content: 'セット中';
    position: absolute; top: -10px; right: -5px; background: #f56565; color: white;
    font-size: 0.6rem; font-weight: 900; padding: 3px 8px; border-radius: 10px; border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.ts-layout .char-card .card-action { display: none; }

.character-action-area {
    position: static;
    transform: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 15px 0;
    background: #e2e8f0;
}
