:root {
  --cyan: #30c5c7;
  --line: #22c8ce;
  font-family: Arial, Helvetica, sans-serif;
  color: #353535;
  background: white;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, input { font: inherit; }
button, a { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; text-decoration: none; }

header {
  height: 100px;
  background: var(--cyan);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 100px;
  justify-content: space-between;
}

header a { font-size: 48px; font-weight: 400; }
header button { border: 0; background: none; color: white; font-size: 16px; }
footer { height: 100px; background: var(--cyan); margin-top: auto; }

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; padding: 24px 100px 60px; }
h2 { color: var(--cyan); font-size: 32px; margin: 0 0 9px; font-weight: 600; }

.outline {
  border: 2px solid var(--line);
  border-radius: 17px;
  background: white;
  color: var(--line);
  min-height: 50px;
  padding: 8px 20px;
  font-size: 22px;
}

.outline:hover { background: #f0fdfd; }
.outline:focus-visible,
button:focus-visible,
a:focus-visible { outline: 3px solid #147578; outline-offset: 4px; }

input {
  border: 2px solid var(--line);
  border-radius: 17px;
  height: 50px;
  padding: 8px 14px;
  font-size: 24px;
  max-width: 100%;
  color: #333;
}

input:focus { outline: 2px solid #147578; outline-offset: 2px; }

.home { text-align: center; padding-top: 42px; }

.logo {
  width: 200px;
  height: 200px;
  margin: 0 auto 28px;
  display: grid;
  place-items: center;
}

.logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.home h1 {
  font-size: 48px;
  font-weight: 400;
  color: var(--cyan);
  margin: 0;
}

.home-actions {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 76px;
  align-items: stretch;
}

.home-actions > .outline {
  width: 400px;
  font-size: 32px;
  height: 100px;
}

.add {
  width: 150px;
  height: 150px;
  min-height: 0;
  padding: 0;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.add-plus {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 68px;
  line-height: 1;
  font-weight: 400;
}

.add-label {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 16px;
  font-size: 20px;
  line-height: 1;
  font-weight: 400;
  text-align: center;
  white-space: nowrap;
}

.home-actions .add {
  width: 140px;
  height: 100px;
}

.home-actions .add .add-plus {
  top: 46px;
  font-size: 64px;
}

.home-actions .add .add-label {
  bottom: 11px;
  font-size: 16px;
  font-weight: 400;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.card {
  width: 300px;
  height: 150px;
  border: 2px solid var(--line);
  border-radius: 17px;
  overflow: hidden;
  position: relative;
  background: #eff9f9;
  flex-shrink: 0;
}

.card > img { width: 100%; height: 100%; object-fit: cover; }
.card .cover { position: absolute; inset: 0; border: 0; background: transparent; width: 100%; text-align: left; padding: 0; }

.card .label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffffc9;
  padding: 3px 12px;
  font-size: 20px;
  font-weight: bold;
  opacity: 0;
}

.card:hover .label,
.card:focus-within .label { opacity: 1; }

/* Kept visible on both desktop and mobile for now. */
.remove {
  position: absolute;
  right: 6px;
  top: 1px;
  border: 0;
  background: transparent;
  color: #ff2738;
  font-size: 34px;
  line-height: 1;
  z-index: 2;
}

.project-name { width: 600px; display: block; margin-bottom: 16px; }

.editor-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  align-items: flex-start;
}

.editor-actions .outline {
  min-width: 0;
  width: max-content;
  max-width: 100%;
  min-height: 0;
  padding: 16px;
  line-height: 1.1;
  white-space: nowrap;
}

.order {
  position: absolute;
  bottom: 0;
  left: 0;
  display: flex;
  background: #ffffffd9;
  gap: 4px;
}

.order button { border: 0; background: none; font-size: 23px; width: 38px; height: 32px; }

.login { max-width: 460px; margin: 0 auto; padding: 40px 20px 50px; }
.login .logo { margin-bottom: 20px; }
.login h1 { text-align: center; color: var(--cyan); font-weight: 400; }
.login label { display: block; margin: 20px 0 8px; }
.login input { width: 100%; font-size: 20px; }
.login .outline { width: 100%; margin-top: 20px; }

.password-row { position: relative; }
.password-row input { padding-right: 65px; }
.password-row button { position: absolute; right: 10px; top: 12px; background: none; border: 0; color: #167c80; font-size: 14px; }

.error { color: #b52233; line-height: 1.5; }
.muted { color: #666; font-size: 16px; line-height: 1.5; }
.upload-status { margin-top: 12px; color: #167c80; }

dialog {
  border: 0;
  border-radius: 4px;
  padding: 0;
  width: 498px;
  max-width: calc(100vw - 32px);
  box-shadow: 0 15px 60px #0002;
  color: #34465a;
}

dialog::backdrop { background: #0008; }
.modal-close { display: block; margin: 12px 12px 12px auto; font-size: 24px; color: #888; background: none; border: 0; }
#modal-body { border-top: 1px solid #dae0e6; padding: 16px; text-align: center; }
#modal-body h2 { font-size: 24px; font-weight: 400; color: #34465a; margin: 0 0 28px; }
#modal-body textarea { width: 100%; height: 150px; resize: none; border: 1px solid #c9d1dc; border-radius: 3px; font: 16px Arial; color: #666; padding: 12px; margin: 8px 0 16px; }

.modal-actions { display: flex; gap: 12px; justify-content: center; margin: 16px 0 8px; }
.modal-actions button { border: 1px solid #adb9ca; background: #fafbfd; border-radius: 22px; color: #415775; padding: 10px 16px; font-size: 15px; }
.modal-actions .danger { color: #b52233; }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #21383bef;
  color: white;
  padding: 12px 22px;
  border-radius: 8px;
  z-index: 100;
  display: none;
}

.viewer { position: fixed; inset: 0; background: #222; color: white; }
.panorama { position: absolute; inset: 0; }

.viewer-controls {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 16px;
  z-index: 5;
}

.round {
  border: 2px solid white;
  background: #536069b3;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  color: white;
  font-size: 24px;
  display: grid;
  place-items: center;
  padding: 4px;
}

.round svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; }

.brand {
  position: absolute;
  bottom: 12px;
  left: 12px;
  padding: 4px 8px;
  border-radius: 4px;
  background: #25323966;
  font-size: 15px;
  z-index: 5;
}

.info {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  padding: 0;
}

.info-glyph {
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 25px;
  font-weight: 600;
  font-style: normal;
  line-height: 1;
  transform: translateY(-1px);
}

.thumb-toggle {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: #34434bcc;
  color: white;
  border: 1px solid #fff9;
  padding: 8px 16px;
  border-radius: 20px;
}

.thumbs {
  position: absolute;
  bottom: 65px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 90%;
  display: flex;
  gap: 10px;
  overflow: auto;
  background: #26363b99;
  padding: 12px;
  border-radius: 8px;
  z-index: 5;
}

.thumbs[hidden] { display: none; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: 6px; overflow: hidden; width: 120px; height: 60px; flex-shrink: 0; }
.thumbs button.active { border-color: var(--cyan); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* Custom panorama loader: no box or background. */
.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  z-index: 4;
}

.loading[hidden] { display: none; }

.panorama-loader {
  width: 42px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.45));
}

.panorama-loader span {
  width: 6px;
  height: 28px;
  background: rgba(255,255,255,.96);
  animation-duration: 1.2s;
  animation-timing-function: steps(1, end);
  animation-iteration-count: infinite;
}

.panorama-loader span:nth-child(1) { animation-name: loader-left; }
.panorama-loader span:nth-child(2) { animation-name: loader-middle; }
.panorama-loader span:nth-child(3) { animation-name: loader-right; }

@keyframes loader-left {
  0%, 16.65% { height: 28px; transform: translateY(0); }
  16.66%, 33.32% { height: 28px; transform: translateY(0); }
  33.33%, 49.99% { height: 46px; transform: translateY(0); }
  50%, 66.65% { height: 34px; transform: translateY(0); }
  66.66%, 83.32% { height: 20px; transform: translateY(0); }
  83.33%, 100% { height: 28px; transform: translateY(0); }
}

@keyframes loader-middle {
  0%, 16.65% { height: 28px; transform: translateY(0); }
  16.66%, 33.32% { height: 22px; transform: translateY(-3px); }
  33.33%, 49.99% { height: 34px; transform: translateY(0); }
  50%, 66.65% { height: 46px; transform: translateY(0); }
  66.66%, 83.32% { height: 34px; transform: translateY(0); }
  83.33%, 100% { height: 28px; transform: translateY(0); }
}

@keyframes loader-right {
  0%, 16.65% { height: 28px; transform: translateY(0); }
  16.66%, 33.32% { height: 22px; transform: translateY(3px); }
  33.33%, 49.99% { height: 20px; transform: translateY(0); }
  50%, 66.65% { height: 34px; transform: translateY(0); }
  66.66%, 83.32% { height: 46px; transform: translateY(0); }
  83.33%, 100% { height: 34px; transform: translateY(0); }
}

.viewer-error {
  max-width: min(420px, calc(100vw - 48px));
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(25, 35, 38, .78);
  color: white;
  text-align: center;
  line-height: 1.4;
}

/* Hide Pannellum's built-in loader; the custom loader above replaces it. */
.pnlm-about-msg { display: none !important; }
.pnlm-load-box { display: none !important; }

.empty { color: #666; margin: 20px 0; }
.help { max-width: 420px; line-height: 1.6; margin: auto; }

@media (prefers-reduced-motion: reduce) {
  .panorama-loader span { animation-duration: 2s; }
}

@media (max-width: 800px) {
  header { height: 80px; padding: 0 24px; }
  header a { font-size: 26px; }
  footer { height: 60px; }
  main { padding: 24px; }
  .home { padding-top: 34px; }
  .logo { width: 200px; height: 200px; margin-bottom: 24px; }
  .home h1 { font-size: 30px; }
  .home-actions { margin-top: 45px; gap: 16px; }
  .home-actions > .outline { width: 240px; font-size: 23px; }
  .home-actions .add { width: 112px; height: 100px; }
  .home-actions .add .add-label { font-size: 16px; font-weight: 400; white-space: nowrap; }
  .cards { gap: 14px; }
  .card { width: min(300px, 100%); }
  .card .label { opacity: 1; }
  .login { padding-top: 24px; }
  .editor-actions .outline { width: max-content; max-width: 100%; }
  h2 { font-size: 28px; }
  .brand { font-size: 13px; }
  .thumbs { bottom: 65px; }
}

@media (max-width: 420px) {
  header a { font-size: 21px; }
  header { padding: 0 18px; }
  main { padding: 24px 18px; }
  .home h1 { font-size: 27px; }
  .home-actions { gap: 10px; }
  .home-actions > .outline { width: 190px; font-size: 20px; }
  .home-actions .add { width: 110px; }
  .round { width: 40px; height: 40px; }
}
