body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
    color: #1f2937;
    background:
        radial-gradient(circle at 14% 12%, rgba(255, 214, 102, 0.24), transparent 25%),
        radial-gradient(circle at 88% 10%, rgba(80, 200, 180, 0.18), transparent 25%),
        linear-gradient(135deg, #f8fbff 0%, #eef6f0 50%, #fff7e8 100%);
}

.trig-app {
    width: min(920px, calc(100% - 32px));
    margin: 28px auto 48px;
}

.task-card,
.solution-panel {
    border: 1px solid rgba(23, 50, 77, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 16px 34px rgba(31, 41, 55, 0.12);
}

.task-card {
    padding: clamp(18px, 4vw, 34px);
}

.task-intro {
    margin: 0 0 16px;
    color: #52616f;
    font-size: 17px;
    font-weight: 700;
    text-align: center;
}

.problem-layout {
    display: grid;
    grid-template-columns: minmax(300px, 1.15fr) minmax(240px, 0.85fr);
    align-items: center;
    gap: 24px;
}

.triangle-stage {
    display: grid;
    place-items: center;
    min-height: 270px;
}

.triangle-stage canvas,
.triangle-stage svg {
    width: min(100%, 430px);
    height: auto;
    border: 0;
    background: transparent;
}

.problem-copy {
    font-size: 19px;
    line-height: 1.55;
    text-align: left;
}

.problem-copy strong {
    color: #17324d;
}

.answer-row {
    display: grid;
    grid-template-columns: auto minmax(110px, 180px) auto;
    align-items: center;
    justify-content: start;
    gap: 10px;
    margin-top: 22px;
    font-size: 19px;
    font-weight: 800;
}

.answer-input {
    min-height: 46px;
    border: 2px solid #78c2ad;
    border-radius: 8px;
    padding: 6px 12px;
    background: #fff;
    color: #17324d;
    font-size: 24px;
    font-weight: 900;
    text-align: center;
}

.feedback {
    min-height: 28px;
    margin: 18px 0 0;
    color: #334155;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
}

.feedback.good { color: #15803d; }
.feedback.bad { color: #b91c1c; }

.solution-panel {
    display: none;
    margin-top: 16px;
    padding: 18px 22px;
    color: #334155;
    font-size: 18px;
    line-height: 1.65;
    text-align: center;
}

.solution-panel.visible { display: block; }

.solution-line {
    padding: 6px 0;
}

.action-bar {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 10px;
    margin-top: 18px;
    overflow-x: auto;
    padding: 4px 2px 10px;
}

.action-bar button {
    flex: 0 0 auto;
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 10px 15px;
    background: #dbeafe;
    color: #164e8b;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(31, 41, 55, 0.12);
}

.action-bar .check-button {
    background: #b8f2c6;
    color: #14532d;
}

.effects {
    position: fixed;
    inset: 0;
    z-index: 1400;
    overflow: hidden;
    pointer-events: none;
}

.sparkle,
.fog,
.confetti {
    position: absolute;
    border-radius: 999px;
}

.sparkle {
    width: 9px;
    height: 9px;
    background: #ffd166;
    animation: trig-sparkle 780ms ease-out forwards;
}

.fog {
    width: 42px;
    height: 42px;
    background: rgba(110, 120, 130, 0.22);
    filter: blur(4px);
    animation: trig-fog 820ms ease-out forwards;
}

.confetti {
    width: 11px;
    height: 18px;
    animation: trig-confetti 1200ms ease-out forwards;
}

@keyframes trig-sparkle {
    from { opacity: 1; transform: translate(0, 0) scale(1); }
    to { opacity: 0; transform: translate(var(--x), var(--y)) scale(0.2); }
}

@keyframes trig-fog {
    from { opacity: 0.75; transform: translate(-50%, -50%) scale(0.4); }
    to { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.5); }
}

@keyframes trig-confetti {
    from { opacity: 1; transform: translateY(0) rotate(0deg); }
    to { opacity: 0; transform: translateY(145px) rotate(440deg); }
}

@media (max-width: 720px) {
    .problem-layout { grid-template-columns: 1fr; gap: 8px; }
    .triangle-stage { min-height: 220px; }
    .problem-copy { text-align: center; }
    .answer-row { justify-content: center; }
    .action-bar { justify-content: flex-start; }
}

@media (max-width: 430px) {
    .answer-row { grid-template-columns: auto minmax(90px, 140px) auto; }
    .action-bar { gap: 6px; overflow-x: visible; }
    .action-bar button { padding: 9px 9px; font-size: 12px; }
}
