/* The web game around the stage (owner, 18 Oct 2026): the install door a browser tab shows (src/install/door.js), and
   the "turn your phone" card whenever a phone or tablet is held upright. Neither is part of the 844 × 390 stage: both
   cover the whole window, at the window's own size. */

/* ---------------------------------------------------------------- the install door */
#door {
  position: fixed; inset: 0; z-index: 200; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background-color: var(--paper); background-image: radial-gradient(var(--dots) 1px, transparent 1.2px); background-size: 14px 14px;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.door-in { max-width: 440px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.door-head { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.door-icon { width: 76px; height: 76px; flex: none; border-radius: 18px; border: 2px solid var(--ink); box-shadow: var(--edge); overflow: hidden; }
.door-title { margin: 0; font-size: 25px; font-weight: 800; line-height: 1.12; }
.door-lead { margin: 0; font-size: 15px; font-weight: 700; color: #4A423B; line-height: 1.35; }
.door-state { align-self: stretch; display: flex; align-items: flex-start; gap: 9px; padding: 9px 13px; border-radius: 14px; border: 2px solid var(--ink); background: var(--card); font-size: 14px; font-weight: 800; line-height: 1.3; text-align: left; }
.door-dot { flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 6px; border: 1.5px solid var(--ink); background: var(--honey); }
.door-state.ok .door-dot { background: #7DBE6E; }
.door-state.warn { background: #FCEBE6; }
.door-state.warn .door-dot { background: var(--alert); }
.door-btn { align-self: stretch; min-height: 50px; padding: 0 18px; display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 25px; border: 2px solid var(--ink); background: var(--card); box-shadow: var(--edge); font-size: 17px; font-weight: 800; }
.door-btn.primary { background: var(--honey); }
.door-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.door-btn:disabled { opacity: .6; }
.door-copied { margin: 0; font-size: 13px; font-weight: 800; color: #3E7A55; }

.door-card { display: flex; flex-direction: column; gap: 12px; padding: 14px 14px 16px; border-radius: 20px; border: 2px solid var(--ink); background: var(--card); box-shadow: var(--edge); }
.door-how { margin: 0; font-size: 13px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--label); }
.door-tabs { display: flex; gap: 3px; padding: 3px; border-radius: 18px; border: 2px solid var(--ink); background: var(--paper); }
.door-tab { flex: 1 1 0; min-width: 0; min-height: 44px; padding: 3px 6px; border: 0; border-radius: 14px; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; line-height: 1.1; }
.door-tab.on { background: var(--honey); box-shadow: inset 0 0 0 2px var(--ink); }
.door-mine { font-size: 11px; font-weight: 700; color: var(--muted); }
.door-tab.on .door-mine { color: var(--ink); }
.door-steps { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 11px; }
.door-steps li { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; font-weight: 700; line-height: 1.35; color: #4A423B; }
.door-steps li > span b { color: var(--ink); font-weight: 800; }
.door-n { flex: none; width: 26px; height: 26px; border-radius: 13px; border: 2px solid var(--ink); background: var(--honey); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--ink); }
.door-steps small { display: block; margin-top: 3px; font-size: 13px; color: var(--muted); }
/* a drawing of the button a step names, in the line */
.door-ico { display: inline-flex; vertical-align: -5px; margin: 0 1px; padding: 2px; border-radius: 7px; border: 1.5px solid var(--dots); background: var(--paper); color: var(--ink); }
.door-nb { white-space: nowrap; }
.door-btn svg { flex: none; }

.door-more { display: flex; justify-content: center; }
.door-foot { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.door-note { margin: 0 0 4px; font-size: 14px; font-weight: 700; color: var(--muted); line-height: 1.3; }
.door-link { min-height: 44px; padding: 0 14px; border: 0; background: none; font-size: 14px; font-weight: 800; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* held sideways, or on a computer: the welcome on the left, the steps on the right */
@media (orientation: landscape) and (min-width: 700px) {
  .door-in { max-width: 880px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); column-gap: 22px; row-gap: 8px; align-items: start; }
  .door-head { grid-column: 1; grid-row: 1 / span 2; position: sticky; top: 0; }
  .door-card { grid-column: 2; grid-row: 1; }
  .door-foot { grid-column: 2; grid-row: 2; }
  .door-in.has { display: flex; align-items: stretch; max-width: 480px; } /* (installed already: one column, the steps one tap away) */
  .door-in.has .door-head { position: static; }
  .door-icon { width: 64px; height: 64px; }
  .door-title { font-size: 23px; }
}

/* ---------------------------------------------------------------- turn your phone sideways */
/* any phone or tablet held upright, and any narrow window; never over the install door, which is read upright */
#rotate { display: none; }
@media (orientation: portrait) and (hover: none) and (pointer: coarse), (orientation: portrait) and (max-width: 600px) {
  #rotate {
    position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px; text-align: center;
    background-color: var(--paper); background-image: radial-gradient(var(--dots) 1px, transparent 1.2px); background-size: 14px 14px;
  }
}
html.door-open #rotate { display: none; }
#rotate p { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.2; }
html[lang="en"] #rotate [lang="vi"], html:not([lang="en"]) #rotate [lang="en"] { display: none; }
.rot-art { width: 132px; height: 132px; }
.rot-phone, .rot-heart { transform-origin: 66px 66px; animation: rotTurn 3s ease-in-out infinite; }
.rot-heart { animation-name: rotKeep; } /* (the heart on its screen stays upright as the phone turns) */
@keyframes rotTurn {
  0% { transform: rotate(0deg); opacity: 0; }
  8%, 24% { transform: rotate(0deg); opacity: 1; }
  50%, 86% { transform: rotate(-90deg); opacity: 1; }
  96%, 100% { transform: rotate(-90deg); opacity: 0; }
}
@keyframes rotKeep { 0%, 24% { transform: rotate(0deg); } 50%, 100% { transform: rotate(90deg); } }
@media (prefers-reduced-motion: reduce) { .rot-phone { animation: none; transform: rotate(-90deg); } .rot-heart { animation: none; transform: rotate(90deg); } }
