/* Ancient Script Generator Styles */
.statmat-tool.ancient-script {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  max-width: 800px;
  margin: 0 auto;
  color: #3e2723;
  background-color: #efebe9; /* parchment feel */
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(62, 39, 35, 0.15);
  border: 1px solid #d7ccc8;
  overflow: hidden;
}

.statmat-tool.ancient-script * {
  box-sizing: border-box;
}

.statmat-tool.ancient-script .as-header {
  background: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.1"/></svg>'), linear-gradient(135deg, #5d4037 0%, #3e2723 100%);
  color: #fff;
  padding: 30px 24px;
  text-align: center;
  border-bottom: 4px solid #8d6e63;
}

.statmat-tool.ancient-script .as-icon {
  font-size: 38px;
  margin-bottom: 8px;
  filter: drop-shadow(0 2px 5px rgba(0,0,0,0.4));
}

.statmat-tool.ancient-script .as-header h2 {
  margin: 0 0 8px 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.statmat-tool.ancient-script .as-header p {
  margin: 0;
  font-size: 15px;
  color: #bcaaa4;
}

.statmat-tool.ancient-script .as-container {
  padding: 30px;
}

/* Inputs */
.statmat-tool.ancient-script .input-section {
  background-color: #fff;
  padding: 24px;
  border-radius: 6px;
  border: 1px solid #d7ccc8;
  margin-bottom: 24px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.statmat-tool.ancient-script label {
  display: block;
  font-weight: 700;
  color: #5d4037;
  margin-bottom: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.statmat-tool.ancient-script select,
.statmat-tool.ancient-script textarea {
  width: 100%;
  padding: 14px;
  border: 2px solid #bcaaa4;
  border-radius: 4px;
  font-size: 16px;
  color: #3e2723;
  transition: all 0.2s;
  background-color: #fafafa;
}

.statmat-tool.ancient-script select {
  cursor: pointer;
  font-weight: 600;
}

.statmat-tool.ancient-script textarea {
  resize: vertical;
  font-family: inherit;
}

.statmat-tool.ancient-script select:focus,
.statmat-tool.ancient-script textarea:focus {
  outline: none;
  border-color: #5d4037;
  background-color: #fff;
}

.statmat-tool.ancient-script .mt-3 {
  margin-top: 20px;
}

.statmat-tool.ancient-script .input-actions {
  display: flex;
  justify-content: flex-end;
}

.statmat-tool.ancient-script .btn {
  padding: 10px 24px;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.statmat-tool.ancient-script .btn-secondary {
  background-color: #e4e4e7;
  color: #52525b;
}

.statmat-tool.ancient-script .btn-secondary:hover {
  background-color: #d4d4d8;
}

.statmat-tool.ancient-script .btn-primary {
  background-color: #3e2723;
  color: white;
}

.statmat-tool.ancient-script .btn-primary:hover {
  background-color: #4e342e;
}

/* Results */
.statmat-tool.ancient-script .results-section {
  background-color: #fff;
  padding: 24px;
  border-radius: 6px;
  border: 1px solid #d7ccc8;
}

.statmat-tool.ancient-script .results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #efebe9;
  flex-wrap: wrap;
  gap: 12px;
}

.statmat-tool.ancient-script .results-header h3 {
  margin: 0;
  font-size: 16px;
  color: #5d4037;
  text-transform: uppercase;
}

.statmat-tool.ancient-script .result-box {
  padding: 24px;
  font-size: 28px;
  color: #212121;
  background-color: #fff8e1;
  border: 1px solid #ffecb3;
  border-radius: 4px;
  text-align: center;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Use a system font stack that includes Segoe UI Historic for ancient unicode */
  font-family: "Segoe UI Historic", "Segoe UI Symbol", "Apple Symbols", sans-serif;
  line-height: 1.4;
}

.statmat-tool.ancient-script .helper-text {
  font-size: 12px;
  color: #8d6e63;
  text-align: center;
  font-style: italic;
}

/* Toast */
.statmat-tool.ancient-script .toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: #3e2723;
  color: white;
  padding: 12px 28px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, transform 0.3s, visibility 0.3s;
  z-index: 9999;
}

.statmat-tool.ancient-script .toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Global override for mobile scrolling on long results */
.statmat-tool [class*="result"], 
.statmat-tool [class*="output"],
.statmat-tool [class*="preview"],
.statmat-tool [class*="display"] {
  overflow-x: auto;
  max-width: 100%;
}

/* Global safeguard: ensure main wrapper never exceeds mobile viewport */
.statmat-tool {
  width: 100% !important;
  box-sizing: border-box;
}
