/* Base – no scrollbars inside iframe */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.tool-body {
  background: radial-gradient(circle at top, #fee2e2 0, #f7f7ff 40%, #f3f5ff 100%);
}

/* Shell + card */
.tool-shell {
  max-width: 1120px;
  margin: 16px auto 24px;
  padding: 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fee2e2, #fef9c3);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
}

.tool-card {
  background: #ffffff;
  border-radius: 22px;
  padding: 22px 22px 26px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

/* Header */
.tool-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.tool-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stb-icon {
  background: linear-gradient(135deg, #f97316, #ef4444);
  box-shadow: 0 8px 18px rgba(248, 113, 113, 0.4);
}

.tool-card-icon-text {
  color: #ffffff;
  font-weight: 700;
  font-size: 20px;
}

.tool-card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #201a3b;
}

.tool-card-caption {
  margin: 4px 0 0;
  font-size: 14px;
  color: #6b7280;
}

.tool-main {
  padding-top: 10px;
}

/* Layout */
.stb-layout {
  display: flex;
  gap: 28px;
}

.stb-left {
  flex: 1.1;
}

.stb-right {
  flex: 1;
}

/* Sections */
.stb-section {
  margin-bottom: 18px;
}

.stb-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 6px;
}

.stb-input {
  width: 100%;
  max-width: 140px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.stb-input:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.25);
}

.stb-hint {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #9ca3af;
}

/* Buttons */
.stb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.btn-primary {
  display: inline-block;
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background-image: linear-gradient(135deg, #ef4444, #f97316);
  color: #ffffff;
  box-shadow: 0 10px 20px rgba(248, 113, 113, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 13px 25px rgba(248, 113, 113, 0.4);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 7px 14px rgba(248, 113, 113, 0.3);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  padding: 9px 18px;
  font-size: 14px;
  border-radius: 999px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  color: #4b5563;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.btn-secondary:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

/* Error */
.stb-error {
  min-height: 18px;
  font-size: 13px;
  color: #b91c1c;
  margin: 4px 0 0;
}

/* Result text */
.stb-result-section {
  margin-top: 6px;
}

.stb-section-title {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
  color: #4b5563;
}

.stb-result-text {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

/* History */
.stb-history-section {
  max-height: 220px;
  display: flex;
  flex-direction: column;
}

.stb-history-list {
  list-style: none;
  margin: 0;
  padding: 6px 8px;
  flex: 1;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px dashed #e5e7eb;
  background: #f9fafb;
}

.stb-history-item {
  font-size: 12px;
  color: #4b5563;
  padding: 4px 2px;
  border-bottom: 1px dashed #e5e7eb;
}

.stb-history-item:last-child {
  border-bottom: none;
}

.stb-history-meta {
  font-size: 11px;
  color: #9ca3af;
}

/* Scrollbar for history only */
.stb-history-list::-webkit-scrollbar {
  width: 6px;
}

.stb-history-list::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 999px;
}

.stb-clear-history-btn {
  margin-top: 8px;
  align-self: flex-start;
  border-radius: 999px;
  font-size: 12px;
  padding: 5px 12px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #6b7280;
  cursor: pointer;
}

.stb-clear-history-btn:hover {
  background: #f3f4f6;
}

/* Bottle area */
.stb-bottle-section {
  height: 100%;
}

.stb-bottle-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0 4px;
}

.stb-circle {
  position: relative;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle at top, #fee2e2 0, #fecaca 40%, #fecaca 100%);
  box-shadow: 0 18px 35px rgba(248, 113, 113, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

/* Container for labels (same size as circle) */
.stb-player-labels {
  position: absolute;
  inset: 0;
}

/* Player labels positioned via JS (x/y) */
.stb-player-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 14px;
  font-weight: 600;
  color: #b91c1c;
  background: rgba(255, 255, 255, 0.95);
  padding: 2px 6px;
  border-radius: 999px;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.25);
}

.stb-player-label-hidden {
  display: none;
}

.stb-player-label-active {
  background: #f97316;
  color: #ffffff;
}

/* Center dot */
.stb-center-dot {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #ffffff;
  border: 3px solid rgba(248, 113, 113, 0.9);
  z-index: 3;
}

/* Bottle */
.stb-bottle {
  width: 70%;
  max-width: 190px;
  transform-origin: 50% 50%;
  transition: transform 2.2s cubic-bezier(0.23, 0.89, 0.33, 1.1);
  z-index: 2;
}

/* Fallback if image missing */
.stb-bottle:not([src]), .stb-bottle[src=""] {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 999px;
}

/* Spin animation easing tweak */
.stb-circle.spin-active .stb-bottle {
  transition: transform 2.4s cubic-bezier(0.18, 0.69, 0.26, 1.3);
}

/* Tip */
.stb-card-tip {
  margin: 12px 0 0;
  font-size: 12px;
  color: #6b7280;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .tool-shell {
    margin: 8px;
    padding: 16px;
    border-radius: 18px;
  }

  .tool-card {
    padding: 18px 14px 20px;
  }

  .stb-layout {
    flex-direction: column;
  }

  .stb-right {
    order: -1;
  }

  .stb-bottle-wrapper {
    padding-top: 4px;
  }

  .stb-circle {
    width: 220px;
    height: 220px;
  }
}
