/**
 * Character Drawing Feature Styles
 * 64x64ピクセル専用お絵描き機能のスタイル定義
 */

/* ========================================
   Character Drawing Container
   ======================================== */

.character-drawing-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.character-drawing-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.back-link {
    color: rgb(113, 175, 182);
    text-decoration: none;
    font-size: var(--min-font-size, 1.125rem);
    transition: color 0.3s ease;
}

.back-link:hover {
    color: rgb(95, 155, 162);
    text-decoration: underline;
}

/* ========================================
   Toolbar
   ======================================== */

.character-drawing-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background-color: #f5f5f5;
    border: 2px solid #DDCDBF;
}

.tool-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tool-group {
    display: flex;
    gap: 8px;
}

.tool-btn {
    background-color: #ffffff;
    border: 2px solid #DDCDBF;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    color: rgb(70, 72, 88);
}

.tool-btn:hover {
    background-color: #f0f0f0;
}

.tool-btn.active {
    background-color: rgb(113, 175, 182);
    color: #ffffff;
    border-color: rgb(95, 155, 162);
}

.tool-btn.clear-btn {
    color: #d32f2f;
}

.tool-btn.clear-btn:hover {
    background-color: #ffebee;
}

.color-picker-btn {
    position: relative;
    overflow: hidden;
}

.color-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.slider-group label {
    font-size: var(--min-font-size, 1.125rem);
    color: rgb(70, 72, 88);
    min-width: 50px;
}

.wide-slider {
    width: 150px;
}

.slider-group span {
    font-size: var(--min-font-size, 1.125rem);
    color: rgb(70, 72, 88);
    min-width: 40px;
    text-align: right;
}

.unit {
    font-size: 0.9em;
    margin-left: 2px;
}

/* ========================================
   Canvas Wrapper
   ======================================== */

.character-canvas-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background-color: #f9f9f9;
    border: 2px solid #DDCDBF;
    overflow: auto;
    /* チェッカーボード背景を追加 */
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.canvas-overlay-container {
    position: relative;
    display: inline-block;
}

#characterCanvas {
    width: 512px;
    height: 512px;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    border: 2px solid #333;
    background-color: transparent;
    cursor: crosshair;
    display: block;
}

.floor-guide-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 504px; /* 64x64のy=63の位置（512 * 63/64 = 504） */
    height: 2px;
    background-color: rgba(255, 100, 100, 0.8);
    pointer-events: none; /* マウスイベントを透過 */
    z-index: 10;
    box-shadow: 0 0 4px rgba(255, 100, 100, 0.5);
}

.floor-guide-line::before {
    content: '床';
    position: absolute;
    left: 4px;
    top: -18px;
    font-size: 12px;
    color: rgba(255, 100, 100, 0.9);
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 2px;
    white-space: nowrap;
}

.front-guide-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0; /* 常に左端が前 */
    width: 2px;
    background-color: rgba(100, 150, 255, 0.8);
    pointer-events: none; /* マウスイベントを透過 */
    z-index: 10;
    box-shadow: 0 0 4px rgba(100, 150, 255, 0.5);
}

.front-guide-line::before {
    content: '前';
    position: absolute;
    left: -12px;
    top: 4px;
    font-size: 12px;
    color: rgba(100, 150, 255, 0.9);
    font-weight: bold;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 2px;
    white-space: nowrap;
    transform: rotate(90deg);
    transform-origin: center;
}

/* ========================================
   Submit Section
   ======================================== */

.character-submit-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background-color: #f5f5f5;
    border: 2px solid #DDCDBF;
}

.character-name-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-name-input-group label {
    font-size: var(--min-font-size, 1.125rem);
    font-weight: 500;
    color: rgb(70, 72, 88);
}

.character-name-input-group input {
    padding: 10px;
    font-size: var(--min-font-size, 1.125rem);
    border: 2px solid #DDCDBF;
    background-color: #ffffff;
    color: rgb(70, 72, 88);
    font-family: inherit;
}

.character-name-input-group input:focus {
    outline: none;
    border-color: rgb(113, 175, 182);
}

.character-author-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.character-author-input-group label {
    font-size: var(--min-font-size, 1.125rem);
    font-weight: 500;
    color: rgb(70, 72, 88);
}

.character-author-input-group input {
    padding: 10px;
    font-size: var(--min-font-size, 1.125rem);
    border: 2px solid #DDCDBF;
    background-color: #ffffff;
    color: rgb(70, 72, 88);
    font-family: inherit;
}

.character-author-input-group input:focus {
    outline: none;
    border-color: rgb(113, 175, 182);
}

.submit-btn {
    background-color: rgb(113, 175, 182);
    color: #ffffff;
    padding: 12px 30px;
    border: none;
    font-size: var(--min-font-size, 1.125rem);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: inherit;
}

.submit-btn:hover {
    background-color: rgb(95, 155, 162);
}

.submit-btn:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 768px) {
    .character-drawing-container {
        padding: 10px;
    }
    
    #characterCanvas {
        width: 320px;
        height: 320px;
    }
    
    .floor-guide-line {
        top: 315px; /* 320 * 63/64 = 315 */
    }
    
    .front-guide-line {
        left: 0; /* 常に左端が前 */
    }
    
    .character-drawing-toolbar {
        flex-direction: column;
    }
    
    .tool-section {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    #characterCanvas {
        width: 256px;
        height: 256px;
    }
    
    .floor-guide-line {
        top: 252px; /* 256 * 63/64 = 252 */
    }
    
    .front-guide-line {
        left: 0; /* 常に左端が前 */
    }
}
