/* layout.css — app shell, top bar, stage and panel. */

.app {
  min-height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(12px, 3vw, 32px) env(safe-area-inset-bottom);
  max-width: 1180px;
  margin: 0 auto;
}

/* ---- top bar ----------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px 6px 4px 2px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.brand .mark { width: 26px; height: 26px; flex: none; }
.mark-frame { fill: none; stroke: var(--chalk-faint); stroke-width: 1.4; }
.mark-rules { fill: none; stroke: var(--line); stroke-width: 1.1; }
.mark-dots circle { fill: var(--brass); }
.brand:hover .mark-frame { stroke: var(--chalk-dim); }

.wordmark {
  font-family: var(--font-ui);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.19em;
  text-transform: uppercase;
}

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.topbar-tools { display: flex; align-items: center; gap: 6px; }

.timer {
  font-size: 17px;
  letter-spacing: 0.03em;
  color: var(--chalk-dim);
  min-width: 5ch;
  text-align: right;
  padding-right: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--chalk-dim);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--plate); color: var(--chalk); border-color: var(--line); }

/* ---- stage ------------------------------------------------------------- */

.stage {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: clamp(20px, 3vw, 40px);
  align-items: safe center;
  padding: clamp(18px, 3vh, 34px) 0 28px;
}

.board-area {
  width: 100%;
  max-width: min(100%, 78vh, 660px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.status {
  min-height: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--chalk-dim);
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.2s, transform 0.2s;
}
.status.is-on { opacity: 1; transform: none; }

/* ---- panel ------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 18px;
}

.meters {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  padding-bottom: 4px;
}

.meter { flex: 1; min-width: 0; }

.meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.meter-value { font-size: 13px; color: var(--chalk-dim); }

.meter-track {
  height: 3px;
  background: var(--plate-2);
  border-radius: 2px;
  overflow: hidden;
}
.meter-track i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brass);
  transition: width 0.35s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.meter-stat { text-align: right; }
.meter-stat .meter-value { display: block; font-size: 17px; color: var(--chalk); }

.panel-more { position: relative; }

/* ---- responsive -------------------------------------------------------- */

@media (max-width: 900px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 14px 0 20px;
    align-items: start;
  }
  .panel {
    position: static;
    width: 100%;
    max-width: min(100%, 74vh, 600px);
    margin: 0 auto;
    gap: 13px;
  }
  .board-area { max-width: min(100%, 62vh, 560px); gap: 8px; }
  .status { min-height: 18px; }
}

@media (max-width: 560px) {
  .app { padding-inline: 10px; }
  .topbar { gap: 10px; padding: 11px 0; flex-wrap: wrap; }
  .wordmark { font-size: 16px; letter-spacing: 0.15em; }
  .chips { order: 3; width: 100%; margin-left: 0; }
  .board-area { max-width: 100%; }
  .timer { font-size: 15px; }
  .meters { padding-bottom: 0; }
  .meter-stat .meter-value { font-size: 15px; }
}

@media (max-height: 720px) and (min-width: 901px) {
  .board-area { max-width: min(100%, 66vh, 520px); }
}
