:root {
    color-scheme: light;
    --ink: #1c241c;
    --paper: #f3f0e7;
    --card: #fffdf8;
    --line: #d7d0c3;
    --green: #1f7a45;
    --green-bright: #00c853;
    --danger: #8c2f2f;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

body.is-play {
    background: #000;
    overflow: hidden;
    height: 100%;
}

button, input, select, textarea {
    font: inherit;
}

button {
    background: var(--green);
    color: #fff;
    border: 0;
    border-radius: 12px;
    padding: 0.7rem 1rem;
    min-height: 48px;
    cursor: pointer;
}

button.danger { background: var(--danger); }
button.block { display: block; width: 100%; margin: 0.6rem 0; font-size: 1.15rem; }
button.tab { background: transparent; color: var(--ink); border-bottom: 3px solid transparent; border-radius: 0; }
button.tab.is-on { border-color: var(--green); color: var(--green); }

.card, .controller {
    max-width: 920px;
    margin: 0 auto;
    padding: 1.2rem;
}

.card {
    background: var(--card);
    margin-top: 8vh;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.4rem;
}

label { display: block; margin: 0.8rem 0; }
label.check { display: flex; gap: 0.5rem; align-items: center; }
input, select, textarea {
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.7rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
}
textarea { font-family: ui-monospace, monospace; }

.switch { display: flex; gap: 0.5rem; }
.error { color: var(--danger); min-height: 1.2rem; }
.note { color: #4d564d; }
.top, .tabs, .actions, .filters { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.top { justify-content: space-between; }
.panel { margin-top: 1rem; }
.code { font-size: 1.4rem; letter-spacing: 0.08em; }
.rotation-box {
    margin: 1rem 0;
    padding: 0.8rem 1rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.rotation-box legend {
    padding: 0 0.3rem;
    font-weight: 600;
}
.pet-blocks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.4rem 0 0.6rem;
}
.pet-block {
    min-width: 4.5rem;
    padding: 0.55rem 0.9rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--green);
    color: #fff;
    cursor: grab;
}
.pet-block.is-inactive {
    background: #d7d0c3;
    color: #6a6358;
}
.pet-block.is-dragging {
    opacity: 0.55;
}
.image-preview {
    margin: 0.6rem 0;
}
.image-preview img {
    max-width: 180px;
    max-height: 180px;
    object-fit: contain;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
}
.upload-progress {
    margin: 0.8rem 0;
}
.upload-progress-track {
    height: 0.7rem;
    border-radius: 999px;
    background: #e7e1d6;
    overflow: hidden;
}
.upload-progress-bar {
    height: 100%;
    width: 0;
    background: var(--green);
    transition: width 0.15s linear;
}
.upload-progress-bar.is-indeterminate {
    width: 35% !important;
    animation: upload-pulse 1s ease-in-out infinite;
}
.upload-progress-label {
    display: block;
    margin-top: 0.35rem;
    color: #4d564d;
    font-size: 0.95rem;
}
@keyframes upload-pulse {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(320%); }
}
.coach { margin-bottom: 0.2rem; }
.word { font-size: 2rem; margin: 0.2rem 0 0.8rem; }
.list { list-style: none; padding: 0; }
.list li {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--line);
}
.list img { width: 72px; height: 72px; object-fit: contain; background: #fff; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: 0.45rem; border-bottom: 1px solid var(--line); font-size: 0.95rem; }

.play-stage {
    position: fixed;
    inset: 0;
    background: #000;
    touch-action: none;
    user-select: none;
}
.play-stage.phase-white { background: #fff; }
.play-stage.phase-green { background: var(--green-bright); }
.play-board, .play-svg, .play-columns {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}
.play-svg { display: block; }
.play-wait { color: #222; margin: 1rem; }
.play-leave {
    position: absolute;
    right: 0.6rem;
    bottom: 0.6rem;
    background: #111;
    color: #444;
}
.play-columns { display: flex; }
.play-col { flex: 1; position: relative; }
.play-col img {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 4%;
    height: 68%;
    object-fit: contain;
}
.filter-grayscale { filter: grayscale(1); }
.filter-blur { filter: blur(3px); }
.filter-brighter { filter: brightness(1.45); }
.filter-darker { filter: brightness(0.55); }

@media (max-width: 700px) {
    .card { margin-top: 0; border: 0; }
    table { font-size: 0.8rem; }
}
