* { box-sizing: border-box; }

:root {
  --bg-image: none;
  --right-col: clamp(300px, 27vw, 380px);
  --main-gap: 16px;
  --text-block-pad: 10px;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.page {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  width: 100vw;
  height: 100svh;
  padding: 12px 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 8px;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
  line-height: 1.1;
}

.top-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 3px 14px;
  text-decoration: none;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--right-col);
  grid-template-rows: minmax(0, 1fr);
  gap: var(--main-gap);
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
}

.left-col {
  display: grid;
  grid-template-rows: max-content minmax(0, 1fr);
  gap: var(--main-gap);
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.panel {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel-bg);
  border: 2px solid var(--border);
  box-shadow: var(--panel-shadow);
}

.intro,
.photo-panel,
.controls {
  position: relative;
}

.intro {
  display: flex;
  align-items: center;
  min-height: 9.5rem;
  padding: 20px 24px 18px;
}

.fit-title {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 56px);
  line-height: 1.1;
  white-space: nowrap;
}

.photo-panel {
  display: flex;
  flex-direction: column;
  min-height: min(360px, 45svh);
}

.stream-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: min(280px, 38svh);
  overflow: hidden;
}

.stream-iframe,
.stream-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stream-fallback {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  padding: 6px 10px;
  font-size: 10px;
  text-decoration: none;
}

.written-message {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.written-message span {
  position: absolute;
  left: var(--x, 10%);
  top: var(--y, 10%);
  display: block;
  font-size: var(--size, clamp(28px, 6vw, 72px));
  line-height: 0.9;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(10px) rotate(var(--rot, 0deg));
  transition: opacity 0.34s ease, transform 0.34s ease;
}

.written-message span.is-written {
  opacity: 1;
  transform: translateY(0) rotate(var(--rot, 0deg));
}

.mark-lightning-s { font-size: clamp(22px, 4vw, 48px); }
.mark-lightning-m { font-size: clamp(30px, 5.4vw, 64px); }
.mark-lightning-l { font-size: clamp(38px, 6.8vw, 80px); }

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: var(--right-col);
  max-width: var(--right-col);
  height: 100%;
  min-height: 0;
  padding: 20px 16px 16px;
  justify-self: end;
  overflow: hidden;
}

.controls > .feed,
.controls > .payment-options {
  flex: 0 0 auto;
}

.controls-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls > .payment-options {
  position: relative;
  z-index: 2;
  background: var(--panel-bg);
}

.feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border);
}

.card {
  display: grid;
  align-content: space-between;
  min-height: 58px;
  padding: 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.card:nth-child(2n) { border-right: 0; }
.card.wide { grid-column: 1 / -1; border-right: 0; }

.card span {
  font-size: 11px;
}

.card strong {
  font-size: 18px;
  line-height: 1.1;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.payment-options > div {
  position: relative;
  display: flex;
  min-width: 0;
}

.pay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 14px 6px;
  border: 0;
  border-right: 1px solid var(--border);
  font: inherit;
  cursor: pointer;
}

.payment-options > div:last-child .pay { border-right: 0; }
.pay span:last-child { font-size: 19px; line-height: 1; }

.text-icon {
  --icon-size: 48px;
  display: grid;
  place-items: center;
  width: var(--icon-size);
  height: var(--icon-size);
  font-size: 16px;
  line-height: 0.9;
}

.text-icon-symbol { font-size: 30px; }
.text-icon-lightning-s { --icon-size: 36px; font-size: 22px; }
.text-icon-lightning-m { --icon-size: 44px; font-size: 28px; }
.text-icon-lightning-l { --icon-size: 52px; font-size: 34px; }

.qr {
  position: fixed;
  left: 50vw;
  top: 50vh;
  z-index: 100000;
  width: min(360px, 78vw, 72vh);
  aspect-ratio: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.92);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.qr img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 14px;
  object-fit: contain;
}

.payment-options > div:hover .qr,
.payment-options > div:focus-within .qr {
  opacity: 1;
  z-index: 100001;
  transform: translate(-50%, -50%) scale(1);
}

.payment-desc,
.talk-static {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  word-break: break-word;
}

.payment-desc {
  padding: var(--text-block-pad);
}

.payment-desc-loc {
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.controls .talk-marquee {
  padding: var(--text-block-pad);
}

.log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  font-size: 11px;
}

.sat-ticker {
  overflow: hidden;
}

.page > footer.sat-ticker {
  display: grid;
  grid-template-rows: auto auto;
  gap: 4px;
  min-height: 44px;
  padding: 6px 16px;
}

.sat-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  font-size: 11px;
  white-space: nowrap;
}

.page > footer.sat-ticker .sat-head {
  padding: 0;
}

.sat-scroll { min-width: 0; overflow: hidden; }

.sat-grid {
  display: flex;
  gap: 46px;
  width: max-content;
  white-space: nowrap;
  animation: sat-marquee 32s linear infinite;
}

.sat-card {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.sat-card span {
  font-size: 11px;
}

.sat-card strong {
  font-size: 11px;
  white-space: nowrap;
}

@keyframes sat-marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.cursor-pixel {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 99999;
  opacity: 0;
  font-size: 26px;
  line-height: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: transform 0.14s ease, color 0.14s ease, opacity 0.12s ease;
}

.cursor-pixel::before { content: "⚡"; }
.cursor-pixel.is-visible { opacity: 1; }

.cursor-pixel.is-hovering {
  transform: translate(-50%, -50%) scale(1.65);
}

body.has-pixel-cursor,
body.has-pixel-cursor a,
body.has-pixel-cursor button { cursor: none !important; }

.cursor-trail {
  position: fixed;
  width: 10px;
  height: 10px;
  pointer-events: none;
  z-index: 99998;
  transform: translate(-50%, -50%);
  animation: trail-fade 0.55s steps(4, end) forwards;
}

@keyframes trail-fade {
  to { opacity: 0; transform: translate(-50%, -50%) scale(0.2); }
}

@media (min-width: 741px) {
  .main { grid-template-columns: minmax(0, calc(100% - var(--right-col) - var(--main-gap))) var(--right-col); }
}

@media (max-height: 760px) and (min-width: 741px) {
  .intro { min-height: auto; padding: 14px 20px; }
  .feed .card { min-height: 48px; padding: 8px; }
  .controls { gap: 8px; padding-top: 14px; }
  .controls-scroll { gap: 8px; }
}

@media (max-width: 1100px) {
  :root { --right-col: clamp(260px, 34vw, 340px); }

  .page { gap: 8px; padding: 10px 14px; }
  .main, .left-col { gap: 12px; }
  .intro { min-height: 8.5rem; }
  .controls { gap: 8px; padding: 16px 10px 10px; }
  .fit-title { font-size: clamp(24px, 6vw, 40px); }
  .payment-desc { font-size: 12px; }
  .pay span:last-child { font-size: 14px; }
  .text-icon { --icon-size: 38px; }
  .text-icon-symbol { font-size: 24px; }
  .text-icon-lightning-s { --icon-size: clamp(30px, 5vw, 36px); font-size: clamp(18px, 3.2vw, 22px); }
  .text-icon-lightning-m { --icon-size: clamp(36px, 6vw, 44px); font-size: clamp(22px, 4vw, 28px); }
  .text-icon-lightning-l { --icon-size: clamp(42px, 7vw, 52px); font-size: clamp(26px, 4.8vw, 34px); }
}

@media (max-width: 740px) {
  :root { --right-col: 100%; }

  html, body { height: auto; overflow: auto; }

  .page {
    height: auto;
    min-height: 100svh;
    grid-template-rows: auto auto auto;
    padding: 10px 12px;
    overflow: visible;
  }

  .topbar { padding-bottom: 6px; }
  .brand { gap: 12px 20px; }

  .main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    overflow: visible;
  }

  .left-col {
    grid-template-rows: auto minmax(280px, 52svh);
    width: 100%;
  }

  .intro { min-height: 7.5rem; }
  .photo-panel { min-height: 280px; height: auto; }

  .controls {
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    overflow: visible;
  }

  .controls-scroll {
    overflow: visible;
  }

  .page > footer.sat-ticker { position: sticky; bottom: 0; }

  body.has-pixel-cursor,
  body.has-pixel-cursor a,
  body.has-pixel-cursor button { cursor: auto !important; }

  .cursor-pixel,
  .cursor-trail { display: none !important; }
}
