:root {
    --hagp-bg: #f3f5fb;
    --hagp-surface: #ffffff;
    --hagp-border: #dbe3f0;
    --hagp-primary: #4d3bb3;
    --hagp-primary-2: #244fbf;
    --hagp-text: #13213a;
    --hagp-muted: #667089;
    --hagp-accent: #f2c94c;
    --hagp-green: #3b8d66;
    --hagp-red: #d76767;
    --hagp-shadow: 0 18px 48px rgba(17, 29, 63, 0.10);
    --hagp-radius: 22px;
}

.hagp-wrap,
.hagp-wrap * {
    box-sizing: border-box;
}

.hagp-wrap {
    width: 100%;
    margin: 0 auto;
    font-family: Inter, Arial, Helvetica, sans-serif;
    color: var(--hagp-text);
}

.hagp-shell {
    background: linear-gradient(180deg, #f8f9ff 0%, #eef3fb 100%);
    border: 1px solid var(--hagp-border);
    border-radius: 28px;
    padding: 24px;
    box-shadow: var(--hagp-shadow);
}

.hagp-progress {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.hagp-step {
    background: #fff;
    border: 1px solid var(--hagp-border);
    color: var(--hagp-muted);
    padding: 12px 14px;
    border-radius: 999px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
}

.hagp-step.is-active {
    background: linear-gradient(135deg, var(--hagp-primary), var(--hagp-primary-2));
    color: #fff;
    border-color: transparent;
}

.hagp-screen {
    display: none;
}

.hagp-screen.is-active {
    display: block;
}

.hagp-hero {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    align-items: center;
}

.hagp-badge,
.hagp-section-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 999px;
    background: #ebe9ff;
    color: var(--hagp-primary);
    font-weight: 800;
    font-size: 12px;
    letter-spacing: .02em;
    text-transform: uppercase;
}

.hagp-hero h2,
.hagp-header-block h3 {
    margin: 14px 0 10px;
    line-height: 1.1;
    font-size: clamp(28px, 3vw, 42px);
}

.hagp-header-block h3 {
    font-size: clamp(24px, 2.5vw, 34px);
}

.hagp-hero p,
.hagp-header-block p,
.hagp-mini-card p,
.hagp-side-card p,
.hagp-instruction,
.hagp-rule-card p,
.hagp-result-list {
    color: var(--hagp-muted);
    line-height: 1.6;
    margin: 0;
}

.hagp-card-grid,
.hagp-results-grid,
.hagp-conclusion-grid,
.hagp-reflection-grid,
.hagp-secret-rule {
    display: grid;
    gap: 18px;
}

.hagp-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 20px 0 24px;
}

.hagp-mini-card,
.hagp-side-card,
.hagp-rule-card,
.hagp-board-panel,
.hagp-status-box {
    background: var(--hagp-surface);
    border: 1px solid var(--hagp-border);
    border-radius: var(--hagp-radius);
    padding: 18px;
    box-shadow: 0 8px 20px rgba(26, 42, 71, 0.05);
}

.hagp-mini-card strong,
.hagp-side-card strong,
.hagp-rule-card h4,
.hagp-status-box strong {
    display: block;
    margin-bottom: 8px;
}

.hagp-hero-image-wrap {
    position: relative;
}

.hagp-image-button {
    width: 100%;
    display: block;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: zoom-in;
    position: relative;
}

.hagp-hero-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 24px;
    border: 1px solid var(--hagp-border);
    box-shadow: var(--hagp-shadow);
}

.hagp-zoom-label {
    position: absolute;
    right: 16px;
    bottom: 16px;
    background: rgba(19, 33, 58, .88);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    padding: 8px 12px;
    border-radius: 999px;
}

.hagp-header-block,
.hagp-actions,
.hagp-board-layout {
    display: grid;
    gap: 18px;
}

.hagp-header-block {
    grid-template-columns: 1fr auto;
    align-items: end;
    margin-bottom: 20px;
}

.hagp-status-box {
    min-width: 220px;
}

.hagp-status-box span {
    display: block;
    color: var(--hagp-muted);
    font-size: 13px;
    margin-bottom: 6px;
}

.hagp-board-layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
    align-items: start;
}

.hagp-board-layout.single-column {
    grid-template-columns: 1fr;
}

.hagp-instruction {
    margin-bottom: 14px;
    font-weight: 600;
}

.hagp-sortable,
.hagp-result-list,
.hagp-checklist {
    list-style: none;
    padding: 0;
    margin: 0;
}

.hagp-card-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--hagp-border);
    border-radius: 18px;
    padding: 14px;
    margin-bottom: 12px;
    cursor: grab;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.hagp-card-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 30, 58, .08);
    border-color: #bfd0ee;
}

.hagp-card-item.is-dragging {
    opacity: .7;
    transform: rotate(1deg);
}

.hagp-rank {
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: #ecefff;
    color: var(--hagp-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.hagp-card-title {
    font-weight: 700;
    color: var(--hagp-text);
}

.hagp-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.hagp-chip {
    padding: 6px 10px;
    border-radius: 999px;
    background: #f0f4fb;
    color: var(--hagp-muted);
    font-size: 12px;
    font-weight: 700;
}

.hagp-handle {
    color: var(--hagp-muted);
    font-size: 20px;
    user-select: none;
}

.hagp-actions {
    grid-template-columns: repeat(2, auto);
    justify-content: space-between;
    margin-top: 24px;
}

.hagp-btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease;
}

.hagp-btn:hover {
    transform: translateY(-1px);
}

.hagp-btn-primary {
    background: linear-gradient(135deg, var(--hagp-primary), var(--hagp-primary-2));
    color: #fff;
    box-shadow: 0 12px 24px rgba(77, 59, 179, .22);
}

.hagp-btn-secondary {
    background: #fff;
    color: var(--hagp-text);
    border: 1px solid var(--hagp-border);
}

.hagp-reflection-grid,
.hagp-results-grid,
.hagp-conclusion-grid,
.hagp-secret-rule {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hagp-checklist li {
    position: relative;
    padding-left: 28px;
    margin-bottom: 12px;
    color: var(--hagp-text);
    line-height: 1.5;
}

.hagp-checklist li::before {
    content: "✔";
    position: absolute;
    left: 0;
    top: 0;
    color: var(--hagp-green);
    font-weight: 900;
}

.hagp-lock {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: #fff5df;
    color: #8f6a09;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 12px;
}

.hagp-result-list li {
    margin-bottom: 10px;
    color: var(--hagp-text);
    line-height: 1.45;
}

.hagp-pill-note {
    display: inline-flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: #f0f7ef;
    color: var(--hagp-green);
    font-size: 12px;
    font-weight: 800;
    margin: 0 8px 8px 0;
}

.hagp-warning-note {
    background: #fff0f0;
    color: #b14a4a;
}

.hagp-modal[hidden] {
    display: none;
}

.hagp-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
}

.hagp-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 18, 33, .75);
}

.hagp-modal-dialog {
    position: relative;
    z-index: 2;
    width: min(1200px, calc(100vw - 32px));
    margin: 4vh auto;
    background: #fff;
    border-radius: 24px;
    padding: 16px;
    box-shadow: var(--hagp-shadow);
}

.hagp-modal-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 18px;
}

.hagp-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 0;
    background: rgba(19, 33, 58, .85);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 980px) {
    .hagp-hero,
    .hagp-board-layout,
    .hagp-reflection-grid,
    .hagp-results-grid,
    .hagp-conclusion-grid,
    .hagp-secret-rule,
    .hagp-header-block {
        grid-template-columns: 1fr;
    }

    .hagp-progress {
        grid-template-columns: 1fr;
    }

    .hagp-card-grid {
        grid-template-columns: 1fr;
    }

    .hagp-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .hagp-shell {
        padding: 16px;
        border-radius: 20px;
    }

    .hagp-card-item {
        grid-template-columns: auto 1fr;
    }

    .hagp-handle {
        grid-column: 1 / -1;
        text-align: right;
        margin-top: -4px;
    }
}


.hagp-topbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.hagp-language-box {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    background: rgba(255,255,255,.8);
    border: 1px solid var(--hagp-border);
    border-radius: 999px;
    padding: 10px 14px;
}

.hagp-language-label {
    font-size: 13px;
    font-weight: 800;
    color: var(--hagp-muted);
}

.hagp-flags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hagp-flag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--hagp-border);
    background: #fff;
    border-radius: 999px;
    padding: 8px 10px;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    font-weight: 700;
    color: var(--hagp-text);
}

.hagp-flag:hover,
.hagp-flag.is-active {
    transform: translateY(-1px);
    border-color: #b9c8e8;
    box-shadow: 0 10px 18px rgba(20,30,58,.08);
}

.hagp-flag.is-active {
    background: linear-gradient(135deg, #f3f0ff, #eef4ff);
}

.hagp-flag span {
    font-size: 18px;
    line-height: 1;
}

.hagp-flag small {
    font-size: 11px;
    line-height: 1;
}

@media (max-width: 767px) {
    .hagp-topbar {
        justify-content: center;
    }
    .hagp-language-box {
        justify-content: center;
        border-radius: 20px;
    }
}

.hagp-sortable {
    touch-action: none;
}

.hagp-card-item {
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.hagp-handle {
    cursor: grab;
    touch-action: none;
    font-size: 22px;
    padding: 6px 8px;
    border-radius: 10px;
    background: #eef3ff;
}

.hagp-handle.is-grabbing {
    cursor: grabbing;
    background: #dde7ff;
}

.hagp-card-item.is-floating {
    opacity: .96;
    box-shadow: 0 20px 45px rgba(0,0,0,.18);
    transform: rotate(-1deg);
}

.hagp-placeholder {
    border: 2px dashed #9db2ff !important;
    background: #f7f9ff !important;
    min-height: 78px;
}

.hagp-sortable.is-sorting {
    background: linear-gradient(180deg, rgba(116,140,255,.05), rgba(116,140,255,0));
    border-radius: 18px;
}

.hagp-badge-grid {
    margin-top: 18px;
}

.hagp-badge-award {
    display: flex;
    gap: 16px;
    align-items: center;
}

.hagp-badge-icon {
    width: 78px;
    height: 78px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    background: linear-gradient(135deg, #fff7d4, #ffe9a8);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}

.hagp-badge-name {
    font-weight: 800;
    font-size: 20px;
    margin-bottom: 6px;
}

.hagp-badge-text {
    margin: 0;
}

.hagp-actions-inline {
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 14px;
}

@media (max-width: 767px) {
    .hagp-badge-award {
        align-items: flex-start;
    }
    .hagp-badge-icon {
        width: 64px;
        height: 64px;
        font-size: 34px;
    }
}
