/* (c) 2026 Wayne State University. All rights reserved. */
.gd {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  background: var(--sl-paper);
}
.ph-pending .gd { visibility: hidden; }

.gd-top {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--sl-space-2);
  padding: var(--sl-space-1) var(--sl-space-2) 2px var(--sl-space-3);
}
.gd-top__lesson {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--sl-text-1);
  font-size: var(--sl-fs-4);
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.gd-eeg { position: relative; flex: 1 1 auto; min-height: 0; touch-action: none; }
#gd-eeg { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.gd-span {
  position: absolute;
  right: var(--sl-space-2);
  bottom: 22px;
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--sl-border);
  border-radius: var(--sl-radius-pill);
  background: color-mix(in srgb, var(--sl-surface) 92%, transparent);
  box-shadow: var(--sl-shadow-1);
}
.gd-span button {
  min-width: 44px;
  height: 36px;
  padding: 0 var(--sl-space-2);
  border: 0;
  background: transparent;
  color: var(--sl-brand);
  font: inherit;
  font-size: var(--sl-fs-1);
  font-weight: 600;
}
.gd-span button[aria-pressed="true"] { background: var(--sl-brand); color: var(--sl-on-brand); }
.gd-span button:focus-visible { outline: 2px solid var(--sl-focus); outline-offset: -2px; }
.gd-pan {
  position: absolute;
  bottom: 1px;
  left: var(--sl-space-2);
  margin: 0;
  padding: 1px var(--sl-space-2);
  border-radius: var(--sl-radius-pill);
  background: var(--sl-brand-tint);
  color: var(--sl-brand);
  font-size: var(--sl-fs-1);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}

.gd-card {
  flex: 0 0 auto;
  box-sizing: border-box;
  height: 34dvh;
  padding: var(--sl-space-2) var(--sl-space-4) var(--sl-space-3);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  border-top: 1px solid var(--sl-border);
  background: var(--sl-surface);
  color: var(--sl-text-1);
  font-size: var(--sl-fs-3);
  line-height: 1.35;
}
.gd-card p { margin: 0; }
.gd-card .ph-card__meta { color: var(--sl-text-3); font-size: var(--sl-fs-1); }
.gd-card .ph-card__text { margin-top: 2px; font-size: var(--sl-fs-4); font-weight: 600; line-height: 1.3; }
.gd-card .ph-card__more,
.gd-card .ph-card__facts,
.gd-card .ph-card__hint,
.gd-card .ph-card__result { margin-top: var(--sl-space-1); color: var(--sl-text-2); font-size: var(--sl-fs-2); line-height: 1.35; }
.gd-card .ph-card__facts { color: var(--sl-text-1); font-weight: 600; }
.gd-card .ph-card__result { color: var(--sl-text-1); font-size: var(--sl-fs-3); }
.gd-card .ph-card__options {
  display: flex;
  flex-direction: column;
  gap: var(--sl-space-2);
  margin: var(--sl-space-2) 0 0;
  padding: 0;
  list-style: none;
}
.gd-card .ph-card__options .sl-btn { width: 100%; min-height: 44px; height: auto; justify-content: flex-start; text-align: left; }
.gd-card .ph-card__options .sl-btn--primary { justify-content: center; }

@media (min-width: 700px) and (min-height: 600px) {
  .gd-card { height: auto; min-height: 7rem; max-height: 40dvh; padding-top: var(--sl-space-3); }
  .gd-card > * { max-width: 46rem; }
  .gd-card .ph-card__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gd-card .ph-card__options li:only-child { grid-column: 1 / -1; }
}

.gd-enter-next { animation: gd-from-below 240ms var(--sl-ease); }
.gd-enter-back { animation: gd-from-above 240ms var(--sl-ease); }
.gd-nudge { animation: gd-nudge 240ms var(--sl-ease); }
@keyframes gd-from-below { from { transform: translateY(28px); opacity: .2; } }
@keyframes gd-from-above { from { transform: translateY(-28px); opacity: .2; } }
@keyframes gd-nudge {
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .gd-enter-next, .gd-enter-back, .gd-nudge { animation: none; }
}

.gd-nav {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sl-space-2);
  border-top: 1px solid var(--sl-border);
  background: var(--sl-surface);
}
.gd-nav__btn {
  min-height: 44px;
  padding: 0 var(--sl-space-3);
  border: 0;
  background: transparent;
  color: var(--sl-brand);
  font: inherit;
  font-size: var(--sl-fs-3);
  font-weight: 600;
}
.gd-nav__btn[aria-disabled="true"] { color: var(--sl-text-3); }
.gd-nav__btn:focus-visible { outline: 2px solid var(--sl-focus); outline-offset: -4px; }
.gd-nav__swipe { display: inline-flex; align-items: center; gap: 2px; color: var(--sl-text-2); font-size: var(--sl-fs-2);
  font-variant-numeric: tabular-nums; }
.gd-nav__swipe svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
  stroke-linejoin: round; }

.gd-sideways { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .gd { display: none; }
  .gd-sideways {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--sl-space-3);
    padding: var(--sl-space-5);
    background: var(--sl-bg);
    color: var(--sl-text-1);
    text-align: center;
  }
  .ph-pending .gd-sideways { visibility: hidden; }
  .gd-sideways h1 { margin: 0; font-size: var(--sl-fs-5); }
  .gd-sideways p { margin: 0; max-width: 420px; color: var(--sl-text-2); }
}
