{% comment %}
room.html table-hex center — included via core/_partials/_table_hex.html
(hex_center). Verbatim move of the old inline .table-center body; inherits
room.html's context (table_status, card_stack_state, viewer_cost_current,
sky_confirmed, polarity_done, user_polarity, current_slot, …).
{% endcomment %}
{# ROLE card-stack — the gamer's own role pick stays available even when their #}
{# token cost has lapsed (deposit-privilege grace, 7d), so it renders OUTSIDE  #}
{# the cost gate below.                                                        #}
{% if room.table_status == "ROLE_SELECT" and card_stack_state %}
    <div class="card-stack" data-state="{{ card_stack_state }}"
        data-starter-roles="{{ starter_roles|join:',' }}"
        data-user-slots="{{ user_slots|join:',' }}"
        data-active-slot="{{ active_slot }}"
        data-equipped-deck="{{ equipped_deck_id|default:'' }}">
        {% if card_stack_state == "ineligible" %}
            <i class="fa-solid fa-ban"></i>
        {% endif %}
    </div>
{% endif %}
{% if not viewer_cost_current %}
    {# Token cost lapsed → GATE VIEW supersedes SCAN SIGS / CAST SKY / DRAW SEA  #}
    {# / the sig waiting msg. The gamer keeps their seat through the renewal     #}
    {# grace; GATE VIEW routes to the renewal gate-view. Only the ROLE pick      #}
    {# (above) survives. `<button>` + onclick (not `<a>`) — `.btn` doesn't reset #}
    {# serif font on anchors. [[feedback-btn-vs-anchor-font-family]]             #}
    <button id="id_room_gate_view_btn" type="button"
            class="btn btn-primary"
            onclick="window.location.href='{% url 'epic:room_gate' room.id %}{% if current_slot %}?seat={{ current_slot }}{% endif %}'">GATE<br>VIEW</button>
{% else %}
    {% if room.table_status == "SKY_SELECT" %}
        {# All three phase btns render so the cascades can cross-fade in place    #}
        {# (no reload): CAST SKY → DRAW SEA on sky-save, then DRAW SEA → SEED MAP  #}
        {# on the 6-card spread completing. The server sets --out on the inactive  #}
        {# ones; the sky/sea cascades swap them. On a reload the server lands the  #}
        {# right one visible (DRAW SEA once sky_confirmed; SEED MAP once the sea   #}
        {# hand is complete), same as each cascade's end. SEED MAP → the Voronoi   #}
        {# map (roadmap step 21) is a stub for now — it only needs to APPEAR here. #}
        <div class="hex-phase-stack">
            <button id="id_pick_sky_btn" class="btn btn-primary hex-phase-btn{% if sky_confirmed %} hex-phase-btn--out{% endif %}">CAST<br>SKY</button>
            <button id="id_pick_sea_btn" class="btn btn-primary hex-phase-btn{% if not sky_confirmed or hand_complete %} hex-phase-btn--out{% endif %}">DRAW<br>SEA</button>
            <button id="id_seed_map_btn" class="btn btn-primary hex-phase-btn{% if not hand_complete %} hex-phase-btn--out{% endif %}">SEED<br>MAP</button>
        </div>
    {% elif room.table_status == "SIG_SELECT" %}
        <button id="id_pick_sky_btn" class="btn btn-primary" style="display:none">CAST<br>SKY</button>
        {% if polarity_done %}
            <p id="id_hex_waiting_msg">{% if user_polarity == "levity" %}Gravity settling . . .{% else %}Levity appraising . . .{% endif %}</p>
        {% endif %}
    {% endif %}
{% endif %}
