:root {
  --col-w: min(66.666vw, 1200px); /* desktop */

  /* 
   latex calculations for placeholder height:
   $$\text{--placeholder-h} + \text{up.height} \times 70\% = 25\text{dvh}$$
   $$\text{--placeholder-h} = 25\text{dvh} - (\text{up.height} \times 0.7)$$
   $$\text{up.height} = \text{var(--col-w)} \times \frac{538}{1360} \approx \text{var(--col-w)} \times 0.3956$$
   max: $1200\text{px} \times 0.3956 = 474.72\text{px}$
   dynamic: $66.666\text{vw} \times 0.3956 \approx 26.37\text{vw}$
   max: $474.72\text{px} \times 0.7 \approx 332.3\text{px}$
   dynamic: $26.37\text{vw} \times 0.7 \approx 18.46\text{vw}$
  */

  --placeholder-h: calc(25dvh - min(18.46vw, 332.3px));
  --stack-y: 0px;
  --glow-blur: 0px;
  --glow-color: rgba(255, 39, 39, 0);
}

@media (max-width: 576px) {
  :root {
    --col-w: min(100vw, 530px); /* mobile proportional scale */

    /* 
     latex calculations for placeholder height:
     $$\text{--placeholder-h} + \text{up.height} \times 70\% = 25\text{dvh}$$
     $$\text{--placeholder-h} = 25\text{dvh} - (\text{up.height} \times 0.7)$$
     $$\text{up.height} = \text{var(--col-w)} \times \frac{538}{1360} \approx \text{var(--col-w)} \times 0.3956$$
     max: $530\text{px} \times 0.3956 = 209.668\text{px}$
     dynamic: $100\text{vw} \times 0.3956 \approx 39.56\text{vw}$
     max: $209.668\text{px} \times 0.7 \approx 146.7676\text{px}$
     dynamic: $39.56\text{vw} \times 0.7 \approx 27.692\text{vw}$
     */

    --placeholder-h: calc(25dvh - min(27.692vw, 146.7676px));
    --stack-y: 0px;
    --glow-blur: 0px;
    --glow-color: rgba(255, 39, 39, 0);
  }
}

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

/* Subtle scrollbars: transparent track, frosted thumb (scroll still works) */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.45);
}

*::-webkit-scrollbar-corner {
  background: transparent;
}
.app {
  height: 100dvh;
  background: url("../assets/theme.png") center/cover no-repeat;
}

.theme-column {
  width: var(--col-w);
  height: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-rows: 75dvh 25dvh;
  overflow: hidden;
}

.up {
  margin: 0 auto;
  width: var(--col-w);
  background-image: url("/assets/up_1.svg");
  background-size: 100% calc(100% + 1px);
  background-position: top center;
  aspect-ratio: 1360 / 538;
  flex: 0 0 auto;
  position: relative;
  height: calc(101% + 2px);
}

.kaiju-svg-mesh {
  display: block;
  width: 100%;
  height: calc(101% + 2px);
  transform-origin: top center;
  shape-rendering: geometricPrecision;
}

.middle {
  margin: 0 auto;
  background-image: url("../assets/middle_1.svg");
  background-position: center;
  background-size: 100% auto;
  width: var(--col-w);
  height: calc(101% + 2px);
  aspect-ratio: 400 / 250;
  min-height: unset;
  padding: 0;
  position: relative;
  flex: 0 0 auto;
}

.placeholder-container {
  width: calc(var(--col-w) * 0.55);
  max-width: 600px;
  background: rgba(20, 20, 35, 0);
  border: 1px solid #49488a00;
  border-radius: 8px;
  padding: 20px;
  color: #fefefe;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0);
  word-wrap: break-word;
}

.placeholder-container h3 {
  width: calc(var(--col-w) * 0.55);
  margin: 0 0 10px 0;
  color: #ddacee;
}

.down {
  background: url("../assets/down_1.svg") repeat-y center / 100% 100%;
  width: var(--col-w);
  aspect-ratio: 1360 / 230;
  height: calc(101% + 2px);
  margin: 0 auto;
  position: relative;
  flex: 0 0 auto;
}

.status-message {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  text-align: center;
  padding: 8px;
  border-radius: 4px;
  font-weight: bold;
  margin: 0;
}

.status-message-slot {
  width: 100%;
  max-width: 100%;
  min-height: 2.5em;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.status-message-slot .status-message {
  width: 100%;
}

.status-message-hidden {
  opacity: 0;
  visibility: hidden;
}

.status-message.status-message-timed {
  opacity: 1;
  visibility: visible;
  animation: statusMessageFade 5s ease forwards;
}

@keyframes statusMessageFade {
  0% {
    opacity: 0;
  }
  8% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.status-error {
  background: #ffcccc;
  color: #cc0000;
}
.status-success {
  background: #ccffcc;
  color: #006600;
}

.realtime-updates-banner {
  width: calc(var(--col-w) * 0.5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 20px;
  border: 2px solid rgba(243, 243, 255, 0.8);
  background: rgba(73, 72, 138, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.realtime-updates-label {
  color: #f4f6ff;
  font-size: clamp(14px, 1.4vw, 22px);
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.realtime-updates-banner .btn-toggle-action {
  background: rgba(129, 137, 255, 0.6);
  border-radius: 32px;
  border: 2px solid rgb(243, 243, 255);
  color: #ffffff;
  text-shadow: 0 1px 3px rgb(236, 231, 255);
  font-size: calc(var(--col-w) * 0.016);
  cursor: pointer;
  box-shadow: 0 0 var(--glow-blur) var(--glow-color);
  padding: 8px 14px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.realtime-updates-banner .btn-toggle-action:hover,
.realtime-updates-banner .btn-toggle-action:focus,
.realtime-updates-banner .btn-toggle-action:active {
  background: rgba(129, 137, 255, 0.75);
  box-shadow: 0 0 8px rgba(129, 137, 255, 0.5);
  outline: none;
}

.signin-btn,
.signout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: calc(var(--col-w) * 0.5);
  min-height: calc(var(--col-w) * 0.035);
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 32px;
  border: 2px solid rgba(73, 72, 128, 1);
  text-shadow: 0 1px 3px rgb(255, 39, 39);
  font-size: calc(var(--col-w) * 0.025);
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
  pointer-events: auto;
  text-align: center;
  box-shadow: 0 0 var(--glow-blur) var(--glow-color);
  margin: 0 auto 10px;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

button.signin-btn,
button.signout-btn {
  appearance: none;
  -webkit-appearance: none;
}

.signin-btn:hover,
.signout-btn:hover,
.signin-btn:focus,
.signout-btn:focus,
.signin-btn:active,
.signout-btn:active {
  background: rgba(129, 137, 255, 0.7);
  box-shadow: 0 0 8px rgba(129, 137, 255, 0.5);
  outline: none;
}

.signin-btn {
  color: #000dff;
}

.signout-btn {
  color: #ff0000;
}

#gallery-header .col-auto {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

#gallery-header .signin-btn,
#gallery-header .signout-btn {
  width: calc(var(--col-w) * 0.5);
  max-width: 100%;
}

.signin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.gallery .comment button {
  width: calc(var(--col-w) * 0.25);
  height: calc(var(--col-w) * 0.05);
  background: rgba(129, 137, 255, 0.461);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 32px;
  border: 2px solid rgb(243, 243, 255);
  color: #ffffff;
  text-shadow: 0 1px 3px rgb(236, 231, 255);
  position: relative;
  margin: 0;
  font-size: calc(var(--col-w) * 0.025);
  cursor: pointer;
  pointer-events: auto;
  align-self: center;
  text-align: center;
  box-shadow: 0 0 var(--glow-blur) var(--glow-color);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.gallery-card-column {
  display: flex;
  justify-content: center;
}

.gallery-card-media {
  position: relative;
  width: calc(var(--col-w) * 0.5);
  height: auto;
  align-self: center;
  justify-self: center;
  display: block;
  overflow: hidden;
}

.gallery-card-media img {
  display: block;
  width: 100%;
  height: auto;
  align-self: center;
  justify-self: center;
}

.gallery-card-empty {
  width: 100%;
  min-height: 180px;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-card-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  row-gap: clamp(6px, 1.5vw, 18px);
  padding: clamp(10px, 2.5vw, 28px);
  text-align: center;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.gallery-card-overlay h2 {
  grid-row: 1;
  align-self: start;
  justify-self: center;
  width: min(100%, calc(var(--col-w) * 0.85));
  font-family: "Segoe UI Black", sans-serif;
  font-weight: bold;
  text-align: center;
  color: #ffffff;
  font-size: clamp(16px, 2vw, 32px);
  line-height: 1.15;
  text-shadow: 0 4px 15px rgb(0, 0, 0);
  margin: 0;
}

.gallery-card-overlay .view-gallery-btn {
  grid-row: 3;
  align-self: end;
  margin: 0;
  pointer-events: auto;
  width: clamp(96px, calc(var(--col-w) * 0.24), 220px);
  min-height: calc(var(--col-w) * 0.035);
  padding: 8px 16px;
  background: rgba(129, 137, 255, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 32px;
  border: 2px solid rgb(243, 243, 255);
  color: #ffffff;
  text-shadow: 0 1px 3px rgb(236, 231, 255);
  font-size: calc(var(--col-w) * 0.02);
  font-family: inherit;
  font-weight: bold;
  line-height: 1.1;
  cursor: pointer;
  box-shadow: 0 0 var(--glow-blur) var(--glow-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.gallery-card-overlay .view-gallery-btn:hover,
.gallery-card-overlay .view-gallery-btn:focus,
.gallery-card-overlay .view-gallery-btn:active {
  background: rgba(129, 137, 255, 0.7);
  box-shadow: 0 0 8px rgba(129, 137, 255, 0.5);
  outline: none;
}
