:root {
    --pink: #ffe8ff;
    --light-blue: #b9d3e8;
    --yellow: #f1dcae;
    --light-red: #f0c8c8;
    --green: #c6dfbd;
    --red: #f37070;

    --bg: var(--pink);
    --card: #ffffff;
    --text: #33302a;
    --muted: #8b8579;
    --border: #ddd7c9;

    --accent: var(--light-blue);
    --accent-strong: #6d95b8;

    --kind-dimension: var(--light-blue);
    --kind-opposition: var(--yellow);
    --kind-text: var(--light-red);
    --kind-choice: var(--green);

    --danger: var(--red);

    --btn-depth: 6px;
    --btn-depth-small: 4px;
    --btn-depth-big: 8px;
    --btn-depth-pressed: 2px;
    --btn-darken-bottom: 15%;
    --btn-darken-right: 35%;

    --main-font: 'Balsamiq Sans', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--main-font);
    line-height: 1.45;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 20px 16px 64px;
}

h1 { font-size: 2rem; margin: 0 0 16px; }
h2 { font-size: 1.4rem; margin: 0 0 12px; }

.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }
.vspace { height: 16px; }
.centered-v { display: flex; align-items: center; }
.flex-h { display: flex; justify-content: center; gap: 10px; }
.flex-h > * { flex: 1; }

.link-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.link-row input { flex: 1; }
.counters { display: flex; gap: 16px; margin: 12px 0; }
.counter { font-size: 1.1rem; margin: 0; }
.nav-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
main.presenter { display: flex; flex-direction: column; min-height: 100vh; }
main.presenter .nav-row { margin-top: auto; padding-top: 24px; }

.home {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
    padding: 32px 16px;
}

.home h1 {
    font-size: 3rem;
    margin: 0;
}

.home .tagline {
    max-width: 420px;
    margin: 0;
}

.home-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
    margin-top: 8px;
}

button {
    position: relative;
    padding: 6px 12px;
    font-family: inherit;
    font-size: 16px;
    background: var(--accent);
    color: var(--text);
    cursor: pointer;
    border: none;
    margin-bottom: var(--btn-depth);
    margin-right: var(--btn-depth);
    user-select: none;
}
button::before { /* bottom face */
    content: '';
    position: absolute;
    left: 0px;
    bottom: calc(-1 * var(--btn-depth));
    height: var(--btn-depth);
    width: 100%;
    background: color-mix(in srgb, black var(--btn-darken-bottom), var(--accent));
    transform: skewX(45deg);
    transform-origin: top left;
}
button::after { /* right face */
    content: '';
    position: absolute;
    top: 0px;
    right: calc(-1 * var(--btn-depth));
    width: var(--btn-depth);
    height: 100%;
    background: color-mix(in srgb, black var(--btn-darken-right), var(--accent));
    transform: skewY(45deg);
    transform-origin: top left;
}

button:active {
    transform: translate(
        calc(var(--btn-depth) - var(--btn-depth-pressed)),
        calc(var(--btn-depth) - var(--btn-depth-pressed))
    );
}
button:active::before {
    bottom: calc(-1 * var(--btn-depth-pressed));
    height: var(--btn-depth-pressed);
}
button:active::after {
    right: calc(-1 * var(--btn-depth-pressed));
    width: var(--btn-depth-pressed);
}


button.danger {
    background: var(--danger);
}
button.danger::before {
    background: color-mix(in srgb, black var(--btn-darken-bottom), var(--danger));
}
button.danger::after {
    background: color-mix(in srgb, black var(--btn-darken-right), var(--danger));
}

button.small {
    --btn-depth: var(--btn-depth-small);
    font-size: 12px;
    padding: 3px 6px;
}

button.big {
    --btn-depth: var(--btn-depth-big);
    font-size: 20px;
    padding: 12px 20px;
}

button.full {
    width: 100%;
}

button:disabled {
    background: var(--border);
    color: var(--muted);
    cursor: not-allowed;
}
button:disabled::before,
button:disabled::after {
    background: var(--border);
}
button:disabled:active {
    transform: none;
}

input[type='text'],
textarea {
    font: inherit;
    width: 100%;
    color: var(--text);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
}

input[type='text']:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-strong);
}

input[type='text'].title {
    font-size: 24px;
}

main.editor input[type='text'],
main.editor textarea {
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--accent);
    border-radius: 0;
    margin-bottom: 1px;
}

main.editor input[type='text']:focus,
main.editor textarea:focus {
    border: none;
    border-bottom: 2px solid var(--accent-strong);
    margin-bottom: 0px;
}

input:disabled,
textarea:disabled {
    opacity: 0.8;
    cursor: not-allowed;
}

input[type='range'] { width: 100%; display: block; margin: 0; }

input[type='range'],
input[type='checkbox'],
input[type='radio'] {
    accent-color: var(--accent-strong);
}

input[type='range'].result-slider {
    pointer-events: none;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.result-header h2 { margin: 0; }
.result-header button { margin-left: auto; }

.result-header .plot-nav {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.result-header .plot-nav button { margin-left: 0; }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.chip {
    background: var(--accent);
    border-radius: 4px;
    padding: 4px 12px;
}

.text-results {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.answer-box {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
}
.answer-count {
    position: absolute;
    top: 4px;
    right: 8px;
    color: var(--muted);
    font-size: 0.85rem;
}

canvas.result-canvas {
    width: 100%;
    height: auto;
    display: block;
}

.question.text input[type='text'],
textarea {
    margin-bottom: 6px;
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--muted);
    margin: 10px 0 4px;
}

.card {
    background: var(--card);
    box-shadow: 3px 3px 0 0 var(--border);
    padding: 14px;
    margin-bottom: 12px;
}

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.space-between { justify-content: space-between; }

.toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 20px; }

.question {
    background: var(--card);
    box-shadow: 3px 3px 0 0 var(--border);
    padding: 4px 12px 8px;
    margin: 4px 0 8px;
}
.question h2 { margin-bottom: 8px; }

/* sections and questions in the editor */

.section-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.section-title-input { flex: 1; }

.question-editor {
    position: relative;
    border-left: 5px solid var(--border);
    padding: 4px 12px 8px;
    margin: 4px 0 8px;
}

.question-editor.dimension { border-left-color: var(--kind-dimension); }
.question-editor.opposition { border-left-color: var(--kind-opposition); }
.question-editor.text { border-left-color: var(--kind-text); }
.question-editor.choice { border-left-color: var(--kind-choice); }

.insert {
    display: block;
    width: 100%;
    margin: 6px 0;
    background: transparent;
    color: var(--muted);
    border: 1px dashed var(--border);
}
.insert::before,
.insert::after { content: none; }
.insert:active { transform: none; }
.insert:hover { border-style: solid; }

.question-header { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }

.kind-badge {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.75rem;
    padding: 2px 8px;
}

.kind-badge.dimension { background: var(--kind-dimension); }
.kind-badge.opposition { background: var(--kind-opposition); }
.kind-badge.text { background: var(--kind-text); }
.kind-badge.choice { background: var(--kind-choice); }

.choice-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    margin-bottom: 6px;
}

.choice-row input {
    flex: 1;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    color: var(--text);
    font-size: 1rem;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.85rem;
    margin: 8px 0 4px;
}

.slider-box { position: relative; }

/* modals */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: color-mix(in srgb, black 45%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 10;
}

.modal {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 20px;
}

.modal.alt-bg {
    background: var(--bg);
}

.modal-close {
    position: sticky;
    top: 0;
    align-self: flex-end;
    z-index: 1;
}

/* question kind picker */

.kind-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 14px;
}

.kind-square {
    width: 140px;
    height: 140px;
    padding: 12px;
    cursor: pointer;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-radius: 5px;
}

.kind-square:hover {
    box-shadow: 5px 5px 0 0 var(--border);
}

.kind-square .check-row {
    margin: 2px 0;
    font-size: 0.85rem;
}

.kind-square input { pointer-events: none; }
.kind-square label { pointer-events: none; }

.kind-square.dimension { background: var(--kind-dimension); }
.kind-square.opposition { background: var(--kind-opposition); }
.kind-square.text { background: var(--kind-text); }
.kind-square.choice { background: var(--kind-choice); }

.kind-square .preview { font-size: 0.8rem; }
.kind-square.text input { padding: 4px 6px; }

.kind-square-title {
    text-align: center;
    font-weight: 600;
    margin-bottom: 10px;
}

@media (min-width: 720px) {
    main { padding: 32px 24px 64px; }
    h1 { font-size: 2.4rem; }
}

/* fonts */

@font-face {
    font-family: 'Balsamiq Sans';
    src: url('fonts/Balsamiq_Sans/BalsamiqSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}
@font-face {
    font-family: 'Balsamiq Sans';
    src: url('fonts/Balsamiq_Sans/BalsamiqSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}
@font-face {
    font-family: 'Balsamiq Sans';
    src: url('fonts/Balsamiq_Sans/BalsamiqSans-Italic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
}
@font-face {
    font-family: 'Balsamiq Sans';
    src: url('fonts/Balsamiq_Sans/BalsamiqSans-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
}

