* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html,
body {
    height: 100%;
}
body {
    font-family: "Segoe UI", system-ui, sans-serif;
    color: #fff;
    overflow: hidden;
    background:
        radial-gradient(1200px 800px at 15% -10%, #253a75 0%, transparent 60%),
        radial-gradient(1000px 700px at 110% 110%, #4a2a6b 0%, transparent 55%),
        linear-gradient(160deg, #0d1530, #101c3f 50%, #1b1440);
}

.glass {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 18px;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
}

#app {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 14px;
    height: 100vh;
    padding: 14px;
}

/* Chart: full width on top. Canvas in flow, sized by its container. */
#chart-wrap {
    position: relative;
    min-height: 0;
}
#chart-wrap canvas {
    width: 100%;
    height: 100%;
}

#bottom {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 14px;
}

#panel {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
}
#panel h1 {
    font-size: 20px;
    font-weight: 600;
}
#panel .hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

#people {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}
#people li {
    display: flex;
    gap: 6px;
    align-items: center;
}
#people input {
    flex: 1;
    min-width: 0;
}
/* ISO base selector and the play/remove buttons: identical squares. */
#people .base,
#people .play,
#people .rm {
    flex: none;
    width: 30px;
    height: 30px;
    padding: 0;
    display: grid;
    place-items: center;
    font-size: 14px;
}
/* CSS spinner shown inside the play button while a person's test runs. */
#people .play span {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: iso-spin 3s linear infinite;
}
@keyframes iso-spin {
    to {
        transform: rotate(360deg);
    }
}
/* The base circle: outlined when not selected, filled white when selected. */
#people .base .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.55);
}
#people .base.active .dot {
    background: #fff;
    border-color: #fff;
}

input {
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    padding: 7px 10px;
    font-size: 14px;
    outline: none;
}
input:focus {
    border-color: rgba(255, 255, 255, 0.5);
}

button {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    padding: 7px 10px;
    font-size: 14px;
}
button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}
button:disabled {
    opacity: 0.45;
    cursor: default;
}
#add-person,
#download {
    width: 100%;
}

#test-area {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 230px;
}
#test-status-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
#replay {
    padding: 4px 10px;
    font-size: 16px;
}
#test-status {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

#blocks {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    flex: 1;
    min-height: 0;
}
.block,
#no-tone {
    transition:
        background 0.15s,
        border-color 0.15s;
}
.block {
    font-size: 30px;
    font-weight: 600;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #fff;
}
.block.ok,
#no-tone.ok {
    background: rgba(34, 197, 94, 0.55);
    border-color: rgba(34, 197, 94, 0.9);
}
.block.bad,
#no-tone.bad {
    background: rgba(239, 68, 68, 0.55);
    border-color: rgba(239, 68, 68, 0.9);
}
.block.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}
#no-tone {
    font-size: 16px;
    font-weight: 600;
    border-radius: 14px;
    padding: 10px;
}

#resume-overlay {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    background: rgba(5, 8, 20, 0.55);
    backdrop-filter: blur(6px);
}
#resume-overlay[hidden] {
    display: none;
}
#resume-overlay .card {
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    text-align: center;
    max-width: 440px;
}
#resume-overlay .row {
    display: flex;
    gap: 10px;
}
