* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: #000;
  color: #fff;
  font-size: 16px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
               sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

.freetext {
  margin: 0;
  padding: 6px 10px;
  background: #111;
  font-size: 25px;
  color: #ccc;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: #111;
  border-bottom: 1px solid #333;
}

.tab-btn {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
  cursor: pointer;
  font-size: 16px;
  min-width: 70px;
  text-align: center;
  user-select: none;
}

.tab-btn.active {
  background: #f5a623;
  border-color: #f5a623;
  color: #000;
  font-weight: 600;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #111;
  border-bottom: 1px solid #333;
  font-size: 16px;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 200px;
}

.controls input[type="range"] {
  width: 100%;
}

.controls button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
  cursor: pointer;
  font-size: 16px;
  white-space: nowrap;
}

.controls button:hover {
  background: #333;
}

.viewer {
  flex: 1 1 auto;
  overflow: auto;
  position: relative;
  cursor: grab;
}

.viewer:active {
  cursor: grabbing;
}

.viewer-inner {
  position: relative;
  width: max-content;
  height: max-content;
}

img {
  max-width: none;
  max-height: none;
  transform-origin: top left;
  display: block;
}

.notice {
  background: #111;
  border-bottom: 1px solid #333;
}

/* Desktop / default */
.freetext {
  margin: 0;
  padding: 6px 10px;
  background: #111;
  font-size: 25px;
  color: #ccc;
}

.notice-toggle {
  display: none;           /* hidden on desktop */
  width: 100%;
  padding: 6px 10px;
  background: #111;
  border: none;
  border-bottom: 1px solid #333;
  color: #ccc;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
}

.notice-arrow {
  margin-left: 8px;
  font-size: 12px;
}

/* Spinner */
#loadingSpinner {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  margin-left: -24px;
  border: 6px solid #444;
  border-top-color: #f5a623;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: none;
  z-index: 10;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Mobile tweaks */
@media (max-width: 768px) {
  .freetext {
    font-size: 13px;
  }
  
  .tabs {
    justify-content: flex-start;
  }

  .tab-btn {
    flex: 1 1 calc(33.33% - 4px);
    font-size: 13px;
    padding: 6px 4px;
  }

  .controls {
    font-size: 13px;
  }

  .controls button {
    flex: 1 1 30%;
    text-align: center;
  }
}
