html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
}

body {
    font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
    background: #fff7ec;
    color: #333;
}

.kids-root {
    height: 100%;
    touch-action: none;
    display: flex;
    flex-direction: column;
}

.safe-margin {
    padding: 16px;
}

.kids-header {
    text-align: center;
    margin-top: 8px;
}

.kids-title {
    font-size: 2.2rem;
    margin: 0;
}

.kids-subtitle {
    margin: 4px 0 0 0;
    color: #666;
}

.start-panel {
    display: flex;
    justify-content: center;
    margin: 24px 0;
    gap: 12px;
}

.kids-btn {
    border: none;
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 1.2rem;
    cursor: pointer;
}

.kids-btn-primary {
    background: #ffb347;
    color: #fff;
}

.kids-btn-secondary {
    background: #ececec;
    color: #333;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    padding-bottom: 24px;
}

.module-card {
    background: #ffffff;
    border-radius: 20px;
    border: none;
    padding: 20px;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-icon {
    font-size: 2rem;
}

.module-card:active {
    transform: scale(0.97);
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.parent-gate-zone {
    position: fixed;
    right: 0;
    bottom: 0;
    width: 80px;
    height: 80px;
    opacity: 0;
}

.parent-gate {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
}

.parent-gate.active {
    display: flex;
}

.gate-card {
    background: #fff;
    border-radius: 20px;
    padding: 24px;
    width: min(90%, 360px);
    text-align: center;
}

.gate-shapes {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin: 16px 0;
}

.gate-shape {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: #ffe0b2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    user-select: none;
}

.piano {
    position: relative;
    flex: 1;
    padding: 16px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.piano-layer {
    display: flex;
    gap: 4px;
}

.piano-white {
    position: relative;
    z-index: 1;
}

.piano-black-layer {
    position: absolute;
    z-index: 2;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
}

.piano-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    padding: 8px 16px 4px;
}

.piano-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 8px;
}

.piano-btn {
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    font-weight: 600;
    cursor: pointer;
}

.piano-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.record-status {
    text-align: center;
    font-size: 0.95rem;
    color: #555;
}

.record-audio {
    width: 100%;
    max-width: 360px;
}

.piano-key {
    border-radius: 8px;
    border: 2px solid #f3d4a6;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
    font-size: 0.95rem;
    height: 190px;
    width: 64px;
}

.piano-white {
    background: #ffffff;
}

.piano-key.piano-black {
    background: #1f1f1f;
    color: #fff;
    border-color: #111;
    height: 120px;
    width: 42px;
    margin: 0;
}

.piano-key.active {
    background: #ffdf9e;
    color: #333;
}

.shape-sorter {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 16px;
}

.shape-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.shape-bin, .shape-piece {
    width: 110px;
    height: 110px;
    border-radius: 20px;
    margin: 12px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4rem;
}

.shape-bin {
    background: #f0f0f0;
    border: 2px dashed #bbb;
}

.shape-piece {
    background: #fff;
    border: 2px solid #ffb347;
    touch-action: none;
}

.shape-bin.success {
    background: #e8f5e9;
    border-color: #81c784;
}

.section-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 16px;
    margin: 12px 16px;
    box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}

.color-match {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.color-canvas {
    width: 240px;
    height: 160px;
    border-radius: 14px;
    border: 3px solid #f3d4a6;
    background: #fff;
}

.color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-chip {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    border: 2px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.12);
    cursor: grab;
}

.read-btn {
    background: #ffecd1;
}

.memory-game {
    text-align: center;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.memory-card {
    background: #fff;
    border: 2px solid #f3d4a6;
    border-radius: 14px;
    height: 80px;
    font-size: 1.6rem;
    cursor: pointer;
}

.memory-card.matched {
    background: #e0f2fe;
    border-color: #38bdf8;
    cursor: default;
}

.limit-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.limit-emoji {
    font-size: 3rem;
}

.limit-title {
    margin: 12px 0 6px;
}

.parent-body {
    background: #f7f7f7;
    overflow: auto;
}

.parent-container {
    max-width: 720px;
    margin: 40px auto;
    background: #fff;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

.parent-title {
    margin-top: 0;
}

.parent-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.parent-form input, .parent-form textarea {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ccc;
}

.parent-save {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background: #ffb347;
    color: white;
    cursor: pointer;
}

.parent-guide {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #eee;
}

.parent-link {
    color: #ff8f3f;
}
