/* The blue every placement affordance on this page wears: the gap a word is
   heading for, the gaps that would take it, the word in hand, and the rail
   naming it. One name so they cannot drift apart. */
body {
    --placement-blue: #2196F3;
}

/* Task-specific styles */

.reading-passage {
    font-size: var(--type-question);
    line-height: 2;
    text-align: left;
    white-space: normal;
    word-break: normal;
}

.reading-passage .paragraph {
    margin-bottom: 1.5rem;
    word-spacing: normal;
    display: block;
    line-height: 2.8;
    white-space: normal;
    overflow-wrap: break-word;
}

.drag-instruction {
    font-weight: bold;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #333;
    padding: 0.5rem;
    background-color: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid var(--placement-blue);
}

.options {
    margin: 1rem 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.option {
    padding: 6px 12px;
    background: #e8e8e8;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    min-width: 120px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #d0d0d0;
    transition: all 0.2s ease;
}

/* Hover is a pointer's idea. A touch browser leaves the last tapped word stuck
   in its hover state with nothing to take it out, so the lift reads as a
   selection the learner never made. */
@media (hover: hover) {
    .option:hover {
        background: #d8d8d8;
        transform: translateY(-2px);
        box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
    }
}

/* A word standing in a blank is part of the sentence now, not a tile laid over
   it: it gives up the bank chip's fixed width, its shadow and its own
   background, and takes the line box the blank sits in. The chip kept all
   three, which is what put a 120x33 box inside a 28px-tall gap and painted it
   across the line above. */
.blank .option {
    /* Inline, so the word joins the blank's own line box instead of opening a
       second one under it: a block-level chip stacks beneath the zero-width
       space below and makes the gap twice as tall as the line it sits in. */
    display: inline;
    min-width: 0;
    width: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    line-height: inherit;
}

/* The gap is sized by what is in it, within a line box of its own: the passage
   sets a generous line-height for legibility, and an inline-block that inherits
   it grows taller than the line it belongs to and collides with its neighbour.
   No width is set here or in script — the word inside decides it. */
.blank {
    display: inline-block;
    min-width: 120px;
    line-height: 1.5;
    padding: 0 8px;
    border: 2px dashed #aaa;
    border-radius: 4px;
    margin: 0 2px;
    vertical-align: baseline;
    white-space: normal;
    text-align: center;
    background-color: #f9f9f9;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* An empty inline-block establishes no line box at all, so a blank with no word
   in it would collapse to the height of its own borders — a rule across the
   page rather than a gap to aim at. A zero-width space gives every blank a line
   box whether or not a word is standing in it. */
.blank::before {
    content: "\200b";
}

/* Where a held word may go. Quieter than the blue a word is about to land in:
   the solid edge says "this will take it", the filled ground says "this one,
   now", and a learner mid-gesture can tell the two apart. */
.blank.ready {
    border-style: solid;
    border-color: var(--placement-blue);
}

/* The blue a move in progress wears: the blank a word is being dragged over,
   the word a tap has picked up and not yet put down, and the bank a placed word
   is being dragged back to — a slot is hovered, the pool is highlighted, and
   either way the learner sees where the word will land before letting go.
   Reorder Paragraphs marks its selected sentence in the same blue. */
.blank.hover,
.option.selected,
#options.highlight {
    border-color: var(--placement-blue);
    background: #e3f2fd;
}

#options.highlight {
    border-radius: 4px;
}

.blank.correct {
    border-color: var(--correct-border);
    background: #e8f5e9; /* paler graded green — page-local, intentionally not the shared graded token */
    border-style: solid;
}

.blank.incorrect {
    border-color: var(--incorrect-border);
    background: #ffebee; /* paler graded red — page-local, intentionally not the shared graded token */
    border-style: solid;
}

/* Unanswered is a graded state, not a wrong one: solid like its marked
   siblings, but neutral slate rather than red. */
.blank.unanswered {
    border-color: var(--control-border-hover);
    background: var(--score-placeholder);
    border-style: solid;
}

/* The rail that names what is being carried, pinned to the top of the screen
   so a word stays legible after the thumb has scrolled away from the bank. */
.held-rail {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--placement-blue);
    color: var(--surface);
    font-weight: 500;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.held-rail.up {
    display: flex;
}

.held-word {
    font-weight: 700;
}

/* The words still free to fill one gap, offered at the gap. */
.gap-picker {
    position: absolute;
    z-index: 950;
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    width: 250px;
    padding: 8px;
    background: var(--surface);
    border: 1px solid var(--control-border-hover);
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
}

.gap-picker.up {
    display: grid;
}

.gap-picker .option {
    min-width: 0;
    box-shadow: none;
}

/* Nav buttons styling from buttons.css */

/* Button colors - using styles from buttons.css */
.nav-icon {
    font-size: 18px;
    vertical-align: middle;
}

.result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    display: none;
}

/* The gesture this Task is answered by is not the same one on a phone as on a
   desktop, and the standing prose says whichever is true. Reorder Paragraphs
   draws the same distinction in the same two class names. */
.touch-hint {
    display: none;
}

/* Keep the existing narrow-layout fallback for the viewport-only test matrix,
   but ask the device what gesture it supports too: a phone in landscape or a
   wide touch tablet must not be told to drag. */
@media (max-width: 768px), (hover: none), (pointer: coarse) {
    .pointer-hint {
        display: none;
    }

    .touch-hint {
        display: inline;
    }
}

/* Mock exam (S5c, owner D4): the word bank is a plain box under the passage,
   as the exam draws it, without the practice page's coaching line. */
body[data-mock-exam] .drag-instruction {
    display: none;
}

body[data-mock-exam] .options {
    padding: 12px;
    border: 1px dashed var(--control-border-hover);
    border-radius: var(--radius-sm);
    background: var(--surface);
}
