﻿/* かたちあわせ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Zen Maru Gothic', sans-serif;
    touch-action: manipulation;
    user-select: none;
}

body {
    background: linear-gradient(180deg, #E8F5E9 0%, #C8E6C9 100%);
}

#game-container.game-shell > .ui-chrome {
    padding-inline-end: max(4px, env(safe-area-inset-right, 0px));
}

#game-container.game-shell .ui-stats-row.shape-stats {
    min-height: 30px;
}

.stat-pill {
    font-size: clamp(0.75rem, 3.2vmin, 0.88rem);
    font-weight: 800;
    color: #37474f;
    background: rgba(255, 250, 245, 0.96);
    padding: 5px 12px;
    border-radius: 999px;
    border: 2px solid #81c784;
}

.shape-play {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 6px 6px 8px;
    gap: 6px;
    overflow: hidden;
}

.hint-text {
    text-align: center;
    font-size: clamp(0.72rem, 3.2vmin, 0.85rem);
    font-weight: 800;
    color: #2e7d32;
    flex-shrink: 0;
    line-height: 1.2;
}

/* ---- スロット（2行 × 3列） ---- */
.slots-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto;
    gap: 6px;
    flex-shrink: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.slot {
    aspect-ratio: 1;
    max-width: min(100px, 28vw);
    max-height: min(92px, 18dvh);
    width: 100%;
    justify-self: center;
    background: rgba(255, 250, 245, 0.96);
    border-radius: 14px;
    border: 2.5px dashed #a5d6a7;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.slot.slot--filled {
    border-style: solid;
    border-color: #66bb6a;
}

.slot.slot--hover {
    border-color: #2e7d32;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.3);
}

.slot-inner {
    width: 76%;
    height: 76%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.slot-inner svg {
    width: 100%;
    height: 100%;
    display: block;
}

.pool-label {
    text-align: center;
    font-size: 0.8rem;
    font-weight: 800;
    color: #33691e;
    flex-shrink: 0;
}

/* ---- プール（9個: 3列 × 3行） ---- */
.pool-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 5px;
    padding: 6px 4px 8px;
    min-height: 0;
    background: rgba(255, 250, 245, 0.82);
    border-radius: 16px;
    border: 2px solid #a5d6a7;
    flex: 1 1 0;
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

.pool-piece {
    width: min(62px, 17vw);
    height: min(62px, 17vw);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fefcf8;
    border-radius: 13px;
    border: 2px solid #c8e6c9;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.08);
    touch-action: none;
    cursor: grab;
}

.pool-piece:active {
    cursor: grabbing;
}

.pool-piece svg {
    width: 82%;
    height: 82%;
    display: block;
    pointer-events: none;
}

.pool-piece.is-dragging {
    opacity: 0.3;
}

/* ---- ドラッグゴースト ---- */
.drag-ghost {
    position: fixed;
    left: 0;
    top: 0;
    width: 62px;
    height: 62px;
    margin-left: -31px;
    margin-top: -31px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fefcf8;
    border-radius: 13px;
    border: 2px solid #66bb6a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
    pointer-events: none;
    z-index: 50000;
}

.drag-ghost svg {
    width: 82%;
    height: 82%;
    display: block;
}

@media screen and (max-height: 700px) {
    .shape-play { gap: 5px; padding: 5px 5px 6px; }
    .slots-row { gap: 5px; }
    .slot {
        max-width: min(96px, 28vw);
        max-height: min(88px, 18dvh);
    }
    .pool-piece { width: min(58px, 16vw); height: min(58px, 16vw); }
    .pool-row { gap: 5px; padding: 6px 4px 8px; }
}

@media screen and (max-height: 560px) {
    .slot { max-height: min(76px, 16dvh); }
    .pool-piece { width: min(52px, 15vw); height: min(52px, 15vw); }
    .drag-ghost { width: 52px; height: 52px; margin-left: -26px; margin-top: -26px; }
}
