:root {
    --hws-orange: #ff8500;
    --hws-orange-dark: #e56e00;
    --hws-orange-soft: #fff0df;
    --hws-navy: #10233d;
    --hws-navy-2: #183a58;
    --hws-blue: #20bfd0;
    --hws-green: #32c982;
    --hws-red: #e84f5f;
    --hws-bg: #f3f6fa;
    --hws-card: #ffffff;
    --hws-text: #23334a;
    --hws-muted: #6f7d90;
    --hws-line: rgba(16, 35, 61, .12);
    --hws-shadow: 0 24px 70px rgba(16, 35, 61, .16);
}

.hws-app,
.hws-app * {
    box-sizing: border-box;
}

.hws-app {
    width: 100%;
    max-width: 1500px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--hws-line);
    border-radius: 26px;
    color: var(--hws-text);
    background: var(--hws-bg);
    box-shadow: var(--hws-shadow);
    font-family: "Poppins", "Segoe UI", sans-serif;
}

.hws-topbar {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 15px 22px;
    color: #fff;
    background: linear-gradient(115deg, #0b1b31, #163451 64%, #1a5264);
}

.hws-brand,
.hws-statusbar,
.hws-module-title,
.hws-dialog-head,
.hws-feedback,
.hws-item-line,
.hws-sequence button {
    display: flex;
    align-items: center;
}

.hws-brand {
    gap: 13px;
}

.hws-logo {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: #fff;
    background: linear-gradient(145deg, #ffab42, var(--hws-orange));
    box-shadow: 0 12px 28px rgba(255, 133, 0, .3);
    font-size: 23px;
    font-weight: 800;
}

.hws-app .hws-brand h1 {
    margin: 2px 0 0;
    color: #fff !important;
    font-weight: 800 !important;
    font-size: clamp(19px, 2vw, 27px);
    line-height: 1.1;
}

.hws-kicker {
    display: block;
    color: rgba(255, 255, 255, .62);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hws-statusbar {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
}

.hws-statusbar > span {
    padding: 8px 11px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 10px;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .76);
    font-size: 11px;
}

.hws-statusbar b {
    color: #fff;
}

.hws-icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 11px;
    color: #fff;
    background: rgba(255, 255, 255, .1);
    cursor: pointer;
}

.hws-icon-button:hover,
.hws-icon-button[aria-pressed="true"] {
    background: var(--hws-orange);
}

.hws-game-shell {
    min-height: 670px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
}

.hws-world {
    position: relative;
    min-width: 0;
    min-height: 670px;
    overflow: hidden;
    background:
        radial-gradient(circle at 70% 15%, rgba(32, 191, 208, .2), transparent 35%),
        linear-gradient(145deg, #0e223b, #183a58);
}

.hws-canvas {
    width: 100%;
    height: 100%;
    display: block;
    outline: none;
    touch-action: none;
}

.hws-loader {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 11px;
    color: #fff;
    text-align: center;
    background: linear-gradient(145deg, #0e223b, #183a58);
    transition: opacity .4s ease, visibility .4s ease;
}

.hws-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.hws-loader-ring {
    width: 54px;
    height: 54px;
    border: 4px solid rgba(255, 255, 255, .16);
    border-top-color: var(--hws-orange);
    border-radius: 50%;
    animation: hws-spin .8s linear infinite;
}

.hws-loader strong {
    font-size: 17px;
}

.hws-loader small {
    color: rgba(255, 255, 255, .62);
}

.hws-world-message {
    position: absolute;
    inset: 20px;
    z-index: 5;
    place-content: center;
    padding: 30px;
    border-radius: 20px;
    color: #fff;
    background: rgba(8, 23, 41, .92);
    text-align: center;
}

.hws-world-message:not([hidden]) {
    display: grid;
}

.hws-camera-controls {
    position: absolute;
    top: 18px;
    right: 18px;
    z-index: 3;
    display: grid;
    grid-template-columns: repeat(3, 42px);
    gap: 7px;
}

.hws-camera-controls button {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .2);
    border-radius: 12px;
    color: #fff;
    background: rgba(7, 25, 44, .82);
    box-shadow: 0 8px 24px rgba(4, 17, 29, .2);
    backdrop-filter: blur(10px);
    cursor: pointer;
    font-size: 19px;
    font-weight: 800;
    line-height: 1;
}

.hws-camera-controls button:hover,
.hws-camera-controls button:focus-visible {
    border-color: var(--hws-orange);
    background: var(--hws-orange);
    outline: 3px solid rgba(255, 133, 0, .22);
}

.hws-help-strip {
    position: absolute;
    left: 18px;
    bottom: 17px;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    pointer-events: none;
}

.hws-help-strip span {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 10px;
    color: rgba(255, 255, 255, .78);
    background: rgba(7, 20, 37, .72);
    backdrop-filter: blur(8px);
    font-size: 10px;
}

.hws-help-strip kbd {
    color: #fff;
    font: inherit;
    font-weight: 800;
}

.hws-tooltip {
    position: absolute;
    z-index: 6;
    max-width: 220px;
    padding: 10px 13px;
    border-radius: 11px;
    color: #fff;
    background: rgba(7, 20, 37, .93);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .25);
    pointer-events: none;
    font-size: 11px;
}

.hws-sidebar {
    display: flex;
    flex-direction: column;
    gap: 13px;
    padding: 21px 17px;
    border-left: 1px solid var(--hws-line);
    background: #fff;
}

.hws-sidebar-head {
    padding: 3px 5px 8px;
}

.hws-sidebar-head span {
    color: var(--hws-orange-dark);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.hws-sidebar-head strong {
    display: block;
    margin-top: 5px;
    color: var(--hws-navy);
    font-size: 17px;
}

.hws-sidebar-head p {
    margin: 6px 0 0;
    color: var(--hws-muted);
    font-size: 11px;
    line-height: 1.55;
}

.hws-module-list {
    display: grid;
    gap: 8px;
}

.hws-module-button {
    width: 100%;
    display: grid;
    grid-template-columns: 42px 1fr auto;
    align-items: center;
    gap: 11px;
    padding: 10px;
    border: 1px solid var(--hws-line);
    border-radius: 14px;
    color: var(--hws-text);
    background: #fff;
    text-align: left;
    cursor: pointer;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.hws-module-button:hover,
.hws-module-button:focus-visible {
    transform: translateX(-3px);
    border-color: rgba(255, 133, 0, .45);
    box-shadow: 0 10px 25px rgba(16, 35, 61, .1);
}

.hws-module-button.is-complete {
    border-color: rgba(50, 201, 130, .35);
    background: #f5fff9;
}

.hws-module-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--hws-orange-soft);
    font-size: 20px;
}

.hws-module-button strong,
.hws-module-button small {
    display: block;
}

.hws-module-button strong {
    color: var(--hws-navy);
    font-size: 12px;
}

.hws-module-button small {
    margin-top: 2px;
    color: var(--hws-muted);
    font-size: 9px;
}

.hws-module-state {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--hws-muted);
    background: #eef2f6;
    font-size: 10px;
    font-weight: 800;
}

.is-complete .hws-module-state {
    color: #fff;
    background: var(--hws-green);
}

.hws-reset-progress {
    margin-top: auto;
    padding: 10px;
    border: 0;
    color: var(--hws-muted);
    background: transparent;
    font-size: 10px;
    cursor: pointer;
}

.hws-reset-progress:hover {
    color: var(--hws-red);
}

.hws-competencies {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 13px;
    padding: 18px;
    border-top: 1px solid var(--hws-line);
    background: #fff;
}

.hws-competencies article {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px 12px;
    align-items: center;
    padding: 13px;
    border: 1px solid var(--hws-line);
    border-radius: 14px;
}

.hws-competencies span,
.hws-competencies b {
    font-size: 10px;
}

.hws-competencies span {
    font-weight: 700;
}

.hws-competencies b {
    color: var(--hws-orange-dark);
}

.hws-competencies div {
    grid-column: 1 / -1;
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf1f5;
}

.hws-competencies i {
    width: 0;
    height: 100%;
    display: block;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--hws-orange), #ffb046);
    transition: width .5s ease;
}

.hws-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(5, 14, 27, .76);
    backdrop-filter: blur(8px);
}

.hws-modal[hidden] {
    display: none;
}

.hws-dialog {
    position: relative;
    width: min(860px, 100%);
    max-height: min(820px, calc(100vh - 40px));
    overflow: auto;
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 35px 100px rgba(0, 0, 0, .35);
}

.hws-close {
    position: sticky;
    z-index: 4;
    top: 13px;
    float: right;
    width: 39px;
    height: 39px;
    margin: 13px 13px -52px 0;
    border: 0;
    border-radius: 12px;
    color: var(--hws-navy);
    background: #eef2f6;
    font-size: 23px;
    cursor: pointer;
}

.hws-dialog-head {
    min-height: 150px;
    gap: 18px;
    padding: 31px 70px 28px 29px;
    color: #fff;
    background:
        radial-gradient(circle at 90% 20%, rgba(255, 133, 0, .42), transparent 31%),
        linear-gradient(125deg, #10233d, #1a4662);
}

.hws-dialog-head .hws-module-icon {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
    font-size: 30px;
}

.hws-dialog-head h2 {
    margin: 0;
    color: #fff;
    font-size: clamp(23px, 4vw, 34px);
}

.hws-dialog-head p {
    margin: 7px 0 0;
    color: rgba(255, 255, 255, .72);
    font-size: 12px;
    line-height: 1.55;
}

.hws-mission {
    padding: 27px;
}

.hws-task-box {
    margin-bottom: 20px;
    padding: 16px;
    border: 1px solid rgba(255, 133, 0, .22);
    border-left: 4px solid var(--hws-orange);
    border-radius: 13px;
    background: var(--hws-orange-soft);
}

.hws-task-box strong,
.hws-task-box span {
    display: block;
}

.hws-task-box strong {
    color: var(--hws-navy);
    font-size: 13px;
}

.hws-task-box span {
    margin-top: 4px;
    color: var(--hws-muted);
    font-size: 11px;
    line-height: 1.55;
}

.hws-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.hws-card {
    padding: 15px;
    border: 1px solid var(--hws-line);
    border-radius: 14px;
    background: #fff;
}

.hws-card h3 {
    margin: 0 0 10px;
    color: var(--hws-navy);
    font-size: 13px;
}

.hws-card p {
    margin: 0 0 10px;
    color: var(--hws-muted);
    font-size: 10px;
    line-height: 1.55;
}

.hws-field {
    display: grid;
    gap: 5px;
    margin-top: 10px;
}

.hws-field label,
.hws-field > span {
    color: var(--hws-navy);
    font-size: 10px;
    font-weight: 700;
}

.hws-field select,
.hws-field input {
    width: 100%;
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--hws-line);
    border-radius: 10px;
    color: var(--hws-text);
    background: #fff;
    font: inherit;
    font-size: 12px;
}

.hws-choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.hws-choice,
.hws-person-button,
.hws-primary,
.hws-secondary,
.hws-sequence button {
    min-height: 42px;
    border-radius: 11px;
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.hws-choice,
.hws-person-button {
    border: 1px solid var(--hws-line);
    color: var(--hws-text);
    background: #fff;
}

.hws-choice:hover,
.hws-person-button:hover,
.hws-choice.is-selected,
.hws-person-button.is-active {
    border-color: var(--hws-orange);
    color: var(--hws-orange-dark);
    background: var(--hws-orange-soft);
}

.hws-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px;
}

.hws-primary,
.hws-secondary {
    padding: 11px 18px;
}

.hws-primary {
    border: 0;
    color: #fff;
    background: linear-gradient(135deg, #ff9b25, var(--hws-orange));
    box-shadow: 0 10px 24px rgba(255, 133, 0, .24);
}

.hws-secondary {
    border: 1px solid var(--hws-line);
    color: var(--hws-navy);
    background: #fff;
}

.hws-feedback {
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.5;
}

.hws-feedback.is-good {
    color: #11663f;
    background: #e9fbf2;
}

.hws-feedback.is-warn {
    color: #805000;
    background: #fff5d8;
}

.hws-feedback.is-bad {
    color: #8b2430;
    background: #fff0f2;
}

.hws-item-line {
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--hws-line);
    font-size: 11px;
}

.hws-item-line:last-child {
    border-bottom: 0;
}

.hws-item-line small {
    color: var(--hws-muted);
}

.hws-sequence {
    display: grid;
    gap: 8px;
}

.hws-sequence button {
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--hws-line);
    color: var(--hws-text);
    background: #fff;
    text-align: left;
}

.hws-sequence button::before {
    content: attr(data-step);
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: var(--hws-muted);
    background: #edf1f5;
    font-size: 10px;
}

.hws-sequence button.is-done {
    border-color: rgba(50, 201, 130, .35);
    color: #11663f;
    background: #f2fff8;
}

.hws-sequence button.is-done::before {
    content: '✓';
    color: #fff;
    background: var(--hws-green);
}

.hws-recipe-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.hws-recipe-table th,
.hws-recipe-table td {
    padding: 10px;
    border-bottom: 1px solid var(--hws-line);
    text-align: left;
}

.hws-recipe-table th {
    color: var(--hws-muted);
    font-size: 9px;
    text-transform: uppercase;
}

.hws-recipe-table input {
    width: 100px;
    min-height: 37px;
    padding: 7px;
    border: 1px solid var(--hws-line);
    border-radius: 8px;
}

.hws-toast {
    position: fixed;
    z-index: 1000000;
    right: 22px;
    bottom: 22px;
    max-width: 360px;
    padding: 13px 16px;
    border-radius: 13px;
    color: #fff;
    background: var(--hws-navy);
    box-shadow: 0 18px 50px rgba(0, 0, 0, .28);
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    font-size: 11px;
}

.hws-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.hws-app:fullscreen {
    width: 100vw;
    max-width: none;
    height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--hws-bg);
}

.hws-app:fullscreen .hws-topbar {
    flex: 0 0 auto;
}

.hws-app:fullscreen .hws-game-shell {
    min-height: 0;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) 330px;
    overflow: hidden;
}

.hws-app:fullscreen .hws-world {
    height: 100%;
    min-height: 0;
}

.hws-app:fullscreen .hws-sidebar {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.hws-app:fullscreen .hws-competencies {
    display: none;
}

@keyframes hws-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 1100px) {
    .hws-game-shell {
        grid-template-columns: 1fr;
    }

    .hws-sidebar {
        border-top: 1px solid var(--hws-line);
        border-left: 0;
    }

    .hws-module-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hws-world {
        min-height: 590px;
    }
}

@media (max-width: 700px) {
    .hws-app {
        border-radius: 17px;
    }

    .hws-topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .hws-statusbar {
        justify-content: flex-start;
    }

    .hws-world {
        min-height: 500px;
    }

    .hws-help-strip span:nth-child(-n+2) {
        display: none;
    }

    .hws-module-list,
    .hws-competencies,
    .hws-grid,
    .hws-choice-grid {
        grid-template-columns: 1fr;
    }

    .hws-dialog-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .hws-mission {
        padding: 19px;
    }

    .hws-recipe-table input {
        width: 75px;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    .hws-app:fullscreen .hws-topbar {
        min-height: 58px;
        padding: 8px 14px;
        flex-direction: row;
        align-items: center;
    }

    .hws-app:fullscreen .hws-logo {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
    }

    .hws-app:fullscreen .hws-game-shell {
        grid-template-columns: minmax(0, 1fr) minmax(220px, 34vw);
    }

    .hws-app:fullscreen .hws-sidebar {
        padding: 13px;
    }

    .hws-app:fullscreen .hws-module-list {
        grid-template-columns: 1fr;
    }

    .hws-app:fullscreen .hws-camera-controls {
        top: 10px;
        right: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hws-app *,
    .hws-app *::before,
    .hws-app *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
