/* Case page — mobile-first */

.case-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem 2rem;
}

/* ====== PHOTO ====== */
.case-photo {
    margin: 0 -1rem;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.case-photo img {
    width: 100%;
    display: block;
}

.case-photo a { display: block; }

.case-photo-full {
    display: block;
    text-align: center;
    padding: 0.3rem;
    font-size: 0.75rem;
    color: #555;
    text-decoration: none;
}

.case-photo-full:hover { color: #888; }

/* Hint rectangles */
.hint-rect {
    position: absolute;
    border: 2px solid rgba(138, 180, 248, 0.7);
    background: rgba(138, 180, 248, 0.08);
    pointer-events: none;
    transition: opacity 0.2s;
}

.hint-rect .hint-label {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.65rem;
    color: #d0d8e8;
    white-space: nowrap;
    background: rgba(40, 60, 100, 0.85);
    padding: 0.1rem 0.35rem;
    line-height: 1.3;
}

.hint-rect.hint-drawing {
    border-color: rgba(168, 216, 168, 0.8);
    background: rgba(168, 216, 168, 0.1);
    pointer-events: auto;
}

.hint-rect.highlighted {
    border-color: rgba(255, 220, 100, 0.9);
    background: rgba(255, 220, 100, 0.12);
    z-index: 2;
}

/* Corner handles for hint rectangles */
.hint-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #8ab4f8;
    border: 2px solid #fff;
    border-radius: 50%;
    z-index: 3;
    touch-action: none;
}

.hint-handle-tl { top: -6px; left: -6px; }
.hint-handle-tr { top: -6px; right: -6px; }
.hint-handle-bl { bottom: -6px; left: -6px; }
.hint-handle-br { bottom: -6px; right: -6px; }

.case-photo.drawing-mode { cursor: crosshair; }

/* ====== INFO ====== */
.case-info {
    padding: 1rem 0 0.5rem;
}

.case-info-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.case-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-open { color: #8ab4f8; border: 1px solid #3a5a8a; }
.status-solved { color: #a8d8a8; border: 1px solid #4a7a4a; }
.status-draft { color: #d8a868; border: 1px solid #7a6a3a; }
.status-archived { color: #888; border: 1px solid #555; }

.case-admin-link {
    color: #555;
    font-size: 0.7rem;
    text-decoration: none;
}

.case-admin-link:hover { color: #888; }

.case-title {
    color: #d0d0d0;
    font-weight: normal;
    font-size: 1.25rem;
    line-height: 1.3;
    margin: 0 0 0.25rem;
}

.case-desc {
    color: #777;
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

.case-summary {
    margin-top: 0.85rem;
    padding: 0.8rem 0;
    border-top: 1px solid #242424;
    border-bottom: 1px solid #242424;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.case-summary-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.case-summary-label {
    color: #6f6f6f;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.case-summary-value {
    color: #d4d4d4;
    font-size: 0.92rem;
    line-height: 1.4;
}

.case-summary-values {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.case-summary-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.5rem;
    border: 1px solid #2b2b2b;
    background: #171717;
    color: #cbcbcb;
    font-size: 0.85rem;
    line-height: 1.35;
}

.case-summary-pill a {
    color: #8ab4f8;
    text-decoration: none;
}

.case-summary-pill a:hover {
    color: #bfd7ff;
}

@media (min-width: 640px) {
    .case-summary-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 1rem;
    }

    .case-summary-label {
        width: 3rem;
        flex-shrink: 0;
        padding-top: 0.15rem;
    }
}

/* ====== STEPS TRACK ====== */
.case-progression {
    margin-top: 0.2rem;
}

.case-progression-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    padding: 0.5rem 0 0.55rem;
    border-top: 1px solid #2b2b2b;
    color: #8a8a8a;
    cursor: pointer;
    list-style: none;
}

.case-progression-toggle::-webkit-details-marker {
    display: none;
}

.case-progression-title {
    color: #9a9a9a;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.case-progression-hint {
    color: #666;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

.case-progression-hint-open {
    display: none;
}

.case-progression[open] .case-progression-hint-open {
    display: inline;
}

.case-progression[open] .case-progression-hint-closed {
    display: none;
}

.case-progression[open] .case-progression-toggle {
    padding-bottom: 0.35rem;
}

.case-progression:not([open]) .steps-track {
    margin-top: 0;
}

.steps-track {
    display: flex;
    flex-direction: column;
}

.steps-track-header {
    margin-top: 1rem;
    padding: 0.5rem 0 0.35rem;
    color: #9a9a9a;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-top: 1px solid #2b2b2b;
}

.steps-track-header:first-child {
    margin-top: 0.25rem;
}

.case-step {
    display: flex;
    gap: 0;
    margin-bottom: 0;
    position: relative;
}

/* Left timeline indicator */
.step-indicator {
    width: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    padding-top: 0.85rem;
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #444;
    border: 2px solid #555;
}

.case-step.active .step-dot {
    background: #3a5a8a;
    border-color: #8ab4f8;
    box-shadow: 0 0 6px rgba(138, 180, 248, 0.3);
}

.step-check {
    color: #6a9a6a;
    font-size: 0.8rem;
    line-height: 1;
}

/* Connecting line between steps */
.case-step:not(:last-child) .step-indicator::after {
    content: '';
    flex: 1;
    width: 1px;
    background: #333;
    margin-top: 0.3rem;
    min-height: 0.5rem;
}

.case-step.resolved:not(:last-child) .step-indicator::after {
    background: #4a7a4a;
}

/* Step content */
.step-content {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0 0.75rem;
    border-bottom: 1px solid #262626;
}

.case-step:last-child .step-content {
    border-bottom: none;
}

.step-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.step-label {
    color: #777;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.case-step.resolved .step-label { color: #6a9a6a; }
.case-step.active .step-label { color: #8ab4f8; }

.step-resolved-value {
    color: #b0d0b0;
    font-size: 0.95rem;
}

.step-answer-count {
    color: #555;
    font-size: 0.7rem;
}

.step-admin-actions {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.step-unresolve-btn {
    background: none;
    border: none;
    color: #553333;
    font-size: 0.6rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.step-unresolve-btn:hover { color: #aa5555; }

.step-copy-photo-coords-btn {
    border: 1px solid #2f4f3f;
    background: rgba(82, 122, 96, 0.14);
    color: #9fc7ab;
    font-size: 0.62rem;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 0.28rem 0.45rem;
    font-family: inherit;
}

.step-copy-photo-coords-btn:hover {
    background: rgba(98, 148, 116, 0.22);
    color: #c1e3cb;
    border-color: #466c58;
}

.step-copy-photo-coords-btn:disabled {
    opacity: 0.72;
    cursor: default;
}

/* Resolved answers (collapsed) */
.resolved-answers {
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.2rem 0.75rem;
}

.resolved-answer {
    color: #555;
    font-size: 0.75rem;
}

/* ====== ANSWER CARDS ====== */
.step-answers {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.answer-card {
    background: #1c1c1c;
    border: 1px solid #2a2a2a;
    padding: 0.5rem 0.65rem;
}

.answer-card.own-answer {
    border-left: 2px solid #3a5a8a;
}

.answer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.answer-author {
    color: #888;
    font-size: 0.75rem;
    text-decoration: none;
}

.answer-author:hover {
    color: #bbb;
}

.resolved-answer a {
    color: inherit;
    text-decoration: none;
}

.resolved-answer a:hover {
    color: #ccc;
}

.answer-actions {
    display: flex;
    gap: 0.6rem;
}

.answer-body {
    margin-top: 0.15rem;
}

.answer-value {
    display: block;
    color: #d0d0d0;
    font-size: 0.9rem;
}

.answer-reasoning {
    color: #666;
    font-size: 0.75rem;
    font-style: italic;
    margin-top: 0.2rem;
    padding-top: 0.2rem;
    border-top: 1px solid #252525;
}

.answer-hint-badge {
    display: inline-block;
    font-size: 0.65rem;
    color: #6a8ab4;
    margin-top: 0.2rem;
    cursor: pointer;
}

.answer-hint-badge:hover { text-decoration: underline; }

/* Action buttons */
.answer-edit-btn,
.answer-resolve-btn,
.answer-delete-btn {
    background: none;
    border: none;
    font-size: 0.65rem;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.answer-edit-btn { color: #556; }
.answer-edit-btn:hover { color: #8ab4f8; }

.answer-resolve-btn { color: #4a6a4a; }
.answer-resolve-btn:hover { color: #a8d8a8; }

.highlighted-btn { color: #a8d8a8 !important; text-decoration: underline; }

.answer-delete-btn { color: #553333; }
.answer-delete-btn:hover { color: #cc6666; }

/* Edit form (inline) */
.answer-edit-form {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.35rem;
}

.answer-edit-form input,
.answer-edit-form textarea,
.answer-edit-form select {
    width: 100%;
    background: #161616;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
    padding: 0.45rem 0.5rem;
    font-family: inherit;
    font-size: 0.85rem;
    resize: vertical;
    -webkit-appearance: none;
    border-radius: 0;
}

/* ====== COORDS MAP ====== */
.step-coords-map {
    height: 220px;
    border: 1px solid #2a2a2a;
    margin-top: 0.5rem;
}

/* ====== ANSWER FORM ====== */
.step-form {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid #2a2a2a;
}

.step-login-callout {
    margin-top: 0.5rem;
    padding-top: 0.65rem;
    border-top: 1px solid #2a2a2a;
}

.step-login-callout p {
    margin: 0;
    color: #8c8c8c;
    font-size: 0.85rem;
    line-height: 1.45;
}

.step-login-callout a {
    color: #8ab4f8;
}

.form-step {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-step input,
.form-step textarea,
.form-step select {
    width: 100%;
    background: #161616;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
    padding: 0.55rem 0.5rem;
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    -webkit-appearance: none;
    border-radius: 0;
}

.form-step input:focus,
.form-step textarea:focus,
.form-step select:focus {
    outline: none;
    border-color: #555;
}

.date-step-fields select.date-select-empty {
    color: #787878;
}

.date-step-fields select.date-select-empty:disabled {
    color: #5f5f5f;
}

.date-step-fields {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.date-field-label {
    display: flex;
    flex-direction: column;
    gap: 0.18rem;
    color: #818181;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.date-field-label span {
    white-space: nowrap;
}

.date-range-inputs,
.date-single-input {
    display: grid;
    gap: 0.4rem;
}

.date-range-inputs {
    grid-template-columns: 1fr 1fr;
}

.date-range-sides {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.date-side {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 0.7rem;
    align-items: start;
}

.date-side-header {
    display: block;
    padding-top: 0.55rem;
}

.date-side-title {
    color: #767676;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.date-parts-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr) minmax(0, 0.8fr);
    gap: 0.4rem;
}

.date-help {
    color: #666;
    font-size: 0.78rem;
    line-height: 1.4;
}

.date-help.is-error {
    color: #d18d8d;
}

.date-field-error {
    border-color: #8a4444 !important;
    background: rgba(122, 74, 74, 0.12) !important;
}

.coords-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
}

@media (max-width: 520px) {
    .date-parts-grid,
    .date-range-inputs {
        grid-template-columns: 1fr;
    }

    .date-side {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .date-side-header {
        padding-top: 0;
    }
}

.hint-btn {
    width: 100%;
    background: transparent;
    border: 1px dashed #3a3a3a;
    color: #666;
    padding: 0.4rem 0.6rem;
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-appearance: none;
    border-radius: 0;
}

.hint-btn:hover {
    border-color: #666;
    color: #8ab4f8;
}

.hint-btn.active {
    border-color: #6a9a6a;
    color: #a8d8a8;
    border-style: solid;
}

.hint-status {
    display: block;
    font-size: 0.75rem;
    color: #6a9a6a;
    min-height: 1em;
}

.hint-edit-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.hint-edit-row .hint-btn {
    width: auto;
    flex: 1;
}

.hint-remove-btn {
    background: transparent;
    border: none;
    color: #666;
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.3rem 0;
}

.hint-remove-btn:hover {
    color: #c66;
}

.submit-btn {
    width: 100%;
    background: #333;
    border: 1px solid #444;
    color: #ccc;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
    -webkit-appearance: none;
    border-radius: 0;
}

.submit-btn:hover {
    background: #444;
    border-color: #555;
    color: #e0e0e0;
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Resolve form */
.resolve-form {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px dashed #2a2a2a;
}

.resolve-form input {
    flex: 1;
    background: #161616;
    border: 1px solid #3a3a3a;
    color: #d0d0d0;
    padding: 0.4rem 0.5rem;
    font-family: inherit;
    font-size: 0.8rem;
    -webkit-appearance: none;
    border-radius: 0;
}

.resolve-form .submit-btn {
    width: auto;
    font-size: 0.75rem;
    padding: 0.4rem 0.65rem;
    white-space: nowrap;
    background: #2a3a2a;
    border-color: #3a5a3a;
    color: #a8d8a8;
}

.resolve-form .submit-btn:hover {
    background: #3a4a3a;
}

/* ====== ROLL ====== */
.case-roll {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #222;
}

.case-roll h3 {
    color: #555;
    font-weight: normal;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}

.roll-strip {
    display: flex;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.5rem;
    scroll-snap-type: x mandatory;
}

.roll-thumb {
    flex-shrink: 0;
    scroll-snap-align: start;
}

.roll-thumb img {
    height: 56px;
    width: auto;
    display: block;
    border: 1px solid #2a2a2a;
    transition: border-color 0.15s ease;
}

.roll-thumb:hover img { border-color: #555; }

/* ====== COMMENTS ====== */
.case-comments {
    margin-top: 2rem;
    border-top: 1px solid #333;
    padding-top: 1.5rem;
}

.case-comments h3 {
    font-size: 1rem;
    color: #c0c0c0;
    font-weight: normal;
    margin-bottom: 1rem;
}

.comment-count { color: #666; }

.case-comment-card {
    padding: 0.6rem 0;
    border-bottom: 1px solid #2a2a2a;
}

.case-comment-card.deleted { opacity: 0.5; }

.case-comment-meta {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
}

.case-comment-author {
    color: #aaa;
    text-decoration: none;
}

.case-comment-author:hover { color: #ccc; }

.case-comment-time { color: #555; }

.case-comment-edited {
    color: #666;
    font-style: italic;
    font-size: 0.75rem;
}

.case-comment-body {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.5;
    word-break: break-word;
}

.case-comment-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

.case-comment-actions button {
    background: none;
    border: none;
    color: #555;
    font-family: inherit;
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0;
}

.case-comment-actions button:hover { color: #999; }

.case-comment-form {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.case-comment-form textarea {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem;
    resize: vertical;
    min-height: 2.5rem;
    box-sizing: border-box;
}

.case-comment-form textarea:focus {
    border-color: #555;
    outline: none;
}

.case-comment-form .submit-btn {
    align-self: flex-end;
    width: auto;
    padding: 0.4rem 1.2rem;
}

.case-comment-edit-area {
    width: 100%;
    background: #1a1a1a;
    border: 1px solid #333;
    color: #ccc;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.5rem;
    resize: vertical;
    min-height: 2.5rem;
    box-sizing: border-box;
    margin-bottom: 0.4rem;
}

.case-comment-edit-actions {
    display: flex;
    gap: 0.5rem;
}

.case-comment-edit-actions button {
    background: #333;
    border: none;
    color: #ccc;
    font-family: inherit;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
}

.case-comment-edit-actions button:hover { background: #444; }

.case-comment-edit-actions .cancel-btn {
    background: transparent;
    color: #666;
}

/* ====== DESKTOP ====== */
@media (min-width: 600px) {
    .case-page {
        padding: 1rem 2rem 2rem;
    }

    .case-photo { margin: 0; }

    .case-photo img {
        border: 1px solid #2a2a2a;
    }

    .case-title { font-size: 1.35rem; }

    .step-coords-map { height: 320px; }

    .roll-thumb img { height: 72px; }
}

@media (min-width: 900px) {
    .case-page { max-width: 1000px; }
}
