:root{
  --bg: #0b1220;
  --card: rgba(255,255,255,0.06);
  --card2: rgba(255,255,255,0.09);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.65);
  --primary: #4f8cff;
  --primary2: #7aa8ff;
  --danger: #ff5c7a;
  --border: rgba(255,255,255,0.12);
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --radius: 16px;
}

*{ box-sizing: border-box; }
html,body{ height: 100%; overflow-x: hidden; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 20% -10%, rgba(79,140,255,0.35), transparent),
              radial-gradient(900px 500px at 100% 0%, rgba(122,168,255,0.22), transparent),
              var(--bg);
  color: var(--text);
  /* Avoid iOS/macOS overscroll "bounce" showing bright areas */
  overscroll-behavior: none;
  overflow-x: hidden;
}

.wrap{
  max-width: 1100px;
  margin: 28px auto;
  padding: 0 16px 40px;
  overflow-x: hidden;
}

.header{
  margin-bottom: 14px;
}

.title{
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 0.2px;
}

.subtitle{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  overflow: hidden;
}

.topGrid{
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 14px;
  align-items: stretch;
}

@media (max-width: 980px){
  .topGrid{ grid-template-columns: 1fr; }
}

.topGrid .left, .topGrid .right{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.14);
  border-radius: 14px;
  padding: 14px;
  min-width: 0; /* prevent grid children overflowing horizontally */
}

.card.result{
  margin-top: 14px;
  background: var(--card2);
}

.field label{
  display:block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

input, select, textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
}

select{
  cursor: pointer;
}

textarea{ resize: vertical; }

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

.primary{
  border: 1px solid rgba(79,140,255,0.5);
  background: linear-gradient(180deg, rgba(79,140,255,0.95), rgba(79,140,255,0.65));
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  font-weight: 700;
  cursor:pointer;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  width: 100%;
  min-width: 0;
}

.primary:disabled{
  cursor:not-allowed;
  opacity: 0.7;
}

.ghost{
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 12px;
  cursor:pointer;
}

.ghost:hover{
  border-color: rgba(79,140,255,0.35);
}

.hint{
  color: var(--muted);
  font-size: 12px;
}


.panel{
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  border-radius: 14px;
  padding: 14px;
  min-height: 240px;
  min-width: 0; /* prevent inner code block from forcing overflow */
}

.panelTitle{
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 10px;
  color: rgba(255,255,255,0.85);
}

.warnings{
  color: var(--muted);
  font-size: 12px;
  white-space: pre-wrap;
  line-height: 1.5;
}

.codeHeader{
  display:flex;
  gap: 10px;
  margin-bottom: 8px;
}

pre.code{
  margin:0;
  max-height: none;
  overflow: visible;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.92);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 100%;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

pre.code.code--success {
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.2);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(18, 25, 40, 0.95);
  backdrop-filter: blur(12px);
  color: var(--text);
  animation: toastIn 0.25s ease-out;
  max-width: min(360px, calc(100vw - 32px));
}

.toast--warn {
  border-color: rgba(255, 180, 80, 0.45);
  background: linear-gradient(135deg, rgba(40, 28, 12, 0.96), rgba(30, 22, 10, 0.96));
  color: #ffc066;
}

.toast--error {
  border-color: rgba(255, 92, 122, 0.45);
  background: linear-gradient(135deg, rgba(40, 18, 22, 0.96), rgba(30, 14, 18, 0.96));
  color: #ff8a9e;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

