/* OTClient Web — canvas + shell (OTArchive browser/shell.html) */
html {
  height: 100%;
  height: -webkit-fill-available;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: #061222;
  overscroll-behavior: contain;
  touch-action: manipulation;
}

/* Ten sam system co soteria.pl — #ArtworkHelper + background-rotator.js */
#ArtworkHelper {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background-color: #061222;
}

#ArtworkHelper .BgLayer {
  position: absolute;
  inset: 0;
  background-color: #061222;
  background-position: top center;
  background-repeat: no-repeat;
  background-size: 1600px auto;
  opacity: 0;
  transition: opacity 1.2s ease-in-out;
}

#ArtworkHelper .BgLayer.is-visible {
  opacity: 1;
}

body.game-active {
  background-color: #000;
}

body.game-active #ArtworkHelper {
  opacity: 0;
  visibility: hidden;
}

body.game-active .soteria-header,
body.game-active #site-container {
  display: none !important;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  height: -webkit-fill-available;
  z-index: 2;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  background: #000;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
}

body.game-active #canvas-container {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.backbuffer,
#canvas {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  border: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: block;
  outline: none;
  image-rendering: optimizeSpeed;
  image-rendering: -moz-crisp-edges;
  image-rendering: -o-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

.title,
#title-text {
  pointer-events: none;
  position: fixed;
  top: 10px;
  left: 10px;
  margin: 0;
  padding: 0;
  color: #fff;
  text-decoration: none;
  z-index: 3;
  text-align: left;
  font-family: "Roboto", Helvetica, sans-serif;
  font-size: 20px;
  -webkit-user-select: none;
  user-select: none;
  display: none;
}

body.game-active .title,
body.game-active #title-text {
  display: block;
  z-index: 5;
  top: auto;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  max-width: min(92vw, 720px);
  padding: 8px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: #f5e6b8;
  font-size: 16px;
  pointer-events: none;
}

#game-error {
  display: none;
  pointer-events: none;
  position: fixed;
  z-index: 6;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: min(92vw, 640px);
  padding: 16px 20px;
  border-radius: 10px;
  background: rgba(40, 8, 8, 0.92);
  border: 1px solid #c44;
  color: #ffd8d8;
  font-family: "Roboto", Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
  white-space: pre-wrap;
}

body.game-active #game-error.visible {
  display: block;
}

#incognito-warning {
  display: none;
  margin: 0.8rem auto 0;
  max-width: 560px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(120, 60, 0, 0.35);
  border: 1px solid #c8943a;
  color: #ffe8b8;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: center;
}

#site-container {
  position: relative;
  z-index: 1;
  overflow-y: auto;
  max-height: 100vh;
  min-height: 100vh;
  min-height: 100dvh;
}

.soteria-header {
  position: relative;
  z-index: 1;
  padding: calc(1.2rem + env(safe-area-inset-top, 0px)) 1rem 0;
  text-align: center;
  color: #f5e6b8;
  text-shadow: 0 2px 2px #000;
}

.soteria-logo-link {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}

.soteria-logo {
  display: block;
  width: min(92vw, 480px);
  height: auto;
  max-height: min(42vw, 220px);
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.55));
}

.soteria-header p {
  color: #b0a0c8;
  margin: 0.4rem 0 0;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
}

.soteria-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem auto 0.5rem;
  max-width: 520px;
  padding: 0 0.5rem;
}

.soteria-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.55rem 1.15rem;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  font-weight: bold;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  color: #fce8ae;
  text-shadow: 0 1px 2px #000;
  background:
    linear-gradient(180deg, #5a3820 0%, #3b2110 48%, #211108 100%);
  border: 1px solid #a67c3a;
  border-radius: 3px;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 169, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 2px 6px rgba(0, 0, 0, 0.45);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition:
    filter 120ms ease,
    border-color 120ms ease,
    transform 80ms ease;
}

.soteria-nav-btn:hover {
  color: #fff3c8;
  border-color: #d4aa55;
  filter: brightness(1.08);
}

.soteria-nav-btn:active {
  transform: translateY(1px);
  filter: brightness(0.95);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.55),
    0 1px 2px rgba(0, 0, 0, 0.35);
}

.soteria-nav-btn:focus-visible {
  outline: 2px solid #e8c547;
  outline-offset: 2px;
}

.soteria-nav-btn--accent {
  color: #fff8dc;
  background:
    linear-gradient(180deg, #7a4e18 0%, #5c3a0c 48%, #3a2408 100%);
  border-color: #e8b84a;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 169, 0.38),
    inset 0 -1px 0 rgba(0, 0, 0, 0.65),
    0 2px 8px rgba(0, 0, 0, 0.5);
}

.soteria-nav-btn--accent:hover {
  border-color: #ffd060;
}

.play-shell {
  width: min(640px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 0 clamp(0.75rem, 4vw, 1.5rem)
    calc(1rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.play-hint {
  text-align: center;
  color: #d4c4a8;
  font-size: clamp(0.9rem, 2.8vw, 1rem);
  line-height: 1.45;
  margin: 0.5rem 0;
}

.play-status-table {
  width: 100%;
  margin: 1rem auto;
  font-size: clamp(0.8rem, 2.5vw, 0.875rem);
  color: #d7c49d;
  border-collapse: collapse;
  opacity: 0.78;
}

.play-status-table th,
.play-status-table td {
  padding: 0.45rem 0.75rem;
  border-top: 1px solid rgba(117, 78, 35, 0.35);
  border-bottom: 1px solid rgba(0, 0, 0, 0.5);
}

.play-status-table th {
  color: #b4915d;
  text-align: left;
  font-family: Georgia, "Times New Roman", serif;
  white-space: nowrap;
}

.play-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.6rem;
  margin: 1rem 0;
  max-width: 360px;
  margin-left: auto;
  margin-right: auto;
}

#play-button {
  display: none;
  cursor: pointer;
  padding: clamp(12px, 3vw, 14px) clamp(20px, 5vw, 32px);
  min-height: 48px;
  background:
    linear-gradient(180deg, #6b4422 0%, #3b2110 52%, #211108 100%);
  border: 1px solid #c99b45;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 169, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.75),
    0 2px 8px rgba(0, 0, 0, 0.55);
  border-radius: 3px;
  color: #fce8ae;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: bold;
  text-align: center;
  text-shadow: 0 1px 2px #000;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

#update-button,
#uninstall-button {
  display: none;
  cursor: pointer;
  text-align: center;
  min-height: 44px;
  padding: 0.5rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#update-button {
  color: #cdbd98;
}

#update-button.is-primary {
  padding: clamp(12px, 3vw, 14px) clamp(20px, 5vw, 32px);
  min-height: 48px;
  background:
    linear-gradient(180deg, #8a5a18 0%, #5c3a0c 52%, #3a2408 100%);
  border: 1px solid #e8b84a;
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 169, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.75),
    0 2px 8px rgba(0, 0, 0, 0.55);
  border-radius: 3px;
  color: #fff3c8;
  font-size: clamp(1rem, 4vw, 1.2rem);
  font-weight: bold;
  text-shadow: 0 1px 2px #000;
}

.update-notice {
  margin: 0.75rem auto 0;
  max-width: 520px;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  text-align: center;
  color: #ffe8b8;
  background: rgba(120, 48, 8, 0.72);
  border: 1px solid #e8a030;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  line-height: 1.45;
}

.update-notice strong {
  display: block;
  color: #ffd060;
  font-size: clamp(1rem, 3vw, 1.1rem);
  margin-bottom: 0.35rem;
}

.update-notice span {
  display: block;
  font-size: clamp(0.85rem, 2.5vw, 0.95rem);
  color: #f5e0b0;
}

#uninstall-button {
  color: #9a856a;
  font-size: clamp(0.8rem, 2.5vw, 0.85rem);
}

.loading-panel {
  position: relative;
  margin: 1.15rem auto 1rem;
  padding: 1rem;
  max-width: 560px;
  color: #e8dcc5;
  background:
    linear-gradient(180deg, rgba(72, 43, 22, 0.92), rgba(28, 18, 12, 0.96)),
    radial-gradient(circle at 50% 0%, rgba(219, 172, 91, 0.22), transparent 70%);
  border: 1px solid #805a2d;
  box-shadow:
    inset 0 0 0 1px rgba(255, 218, 141, 0.12),
    inset 0 0 18px rgba(0, 0, 0, 0.55),
    0 8px 24px rgba(0, 0, 0, 0.45);
}

.loading-panel::before,
.loading-panel::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #d5aa59, transparent);
  opacity: 0.75;
}

.loading-panel::before {
  top: 5px;
}

.loading-panel::after {
  bottom: 5px;
}

.loading-panel__header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  color: #f6d88d;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  font-weight: bold;
  text-align: center;
  text-shadow: 0 1px 2px #000;
}

.loading-panel__ornament {
  width: 42px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #c89a45);
}

.loading-panel__ornament:last-child {
  background: linear-gradient(90deg, #c89a45, transparent);
}

.loading-panel__status {
  min-height: 1.4em;
  margin-top: 0.85rem;
  color: #f0e5ce;
  font-family: Verdana, Arial, sans-serif;
  font-size: clamp(0.82rem, 2.4vw, 0.95rem);
  line-height: 1.4;
  text-align: center;
}

.loading-progress {
  position: relative;
  overflow: hidden;
  height: 19px;
  margin: 0.85rem auto 0;
  border: 1px solid #1a0d05;
  background:
    linear-gradient(180deg, #120905 0%, #27150a 50%, #0b0503 100%);
  box-shadow:
    inset 0 1px 3px #000,
    0 1px 0 rgba(255, 229, 153, 0.16);
}

.loading-progress__fill {
  width: 0%;
  height: 100%;
  background:
    linear-gradient(180deg, #ffe08b 0%, #c4882e 48%, #74420f 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(58, 23, 3, 0.8),
    0 0 10px rgba(227, 160, 57, 0.45);
  transition: width 160ms linear;
}

.loading-progress__shine {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.1) 0,
    rgba(255, 255, 255, 0.1) 8px,
    transparent 8px,
    transparent 17px
  );
  opacity: 0.35;
  pointer-events: none;
}

.loading-panel__detail {
  min-height: 1.2em;
  margin-top: 0.55rem;
  color: #a89372;
  font-family: Verdana, Arial, sans-serif;
  font-size: clamp(0.72rem, 2.1vw, 0.8rem);
  text-align: center;
}

.loading-panel.is-hidden {
  display: none;
}

@media (max-width: 480px) {
  .soteria-links {
    flex-direction: column;
    align-items: stretch;
    max-width: 280px;
  }

  .soteria-nav-btn {
    width: 100%;
    white-space: normal;
  }

  body.game-active .title,
  body.game-active #title-text {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    font-size: 14px;
    padding: 6px 12px;
  }

  #game-error {
    font-size: 14px;
    padding: 14px 16px;
  }
}

@media (max-width: 900px) {
  #ArtworkHelper {
    display: none !important;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .soteria-header {
    padding-top: 0.5rem;
  }

  .soteria-logo {
    max-height: 140px;
  }

  .play-shell {
    padding-top: 0;
  }
}

.soteria-html-login {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(220px, 42vw);
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(12, 10, 18, 0.92);
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: #f2e6c8;
  font: 13px/1.3 system-ui, sans-serif;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.soteria-html-login__title {
  font-weight: 600;
  color: #e8c547;
  font-size: 12px;
}

.soteria-html-login input {
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid #4a3f2a;
  background: #1a1410;
  color: #fff;
}

.soteria-html-login button {
  padding: 7px 10px;
  border: none;
  border-radius: 4px;
  background: linear-gradient(180deg, #c9a227, #8a6d1c);
  color: #1a1008;
  font-weight: 700;
  cursor: pointer;
}

.soteria-html-login__status {
  min-height: 1.2em;
  font-size: 11px;
  color: #b8c4d0;
}

.soteria-version-badge {
  display: none !important;
}
