:root{
  --bg: #0f1724;
  --card: #0b1220;
  --muted: #9aa4b2;
  --accent: #7dd3fc;
  --accent-2: #60a5fa;
  --glass: rgba(255,255,255,0.03);
  --radius: 12px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color-scheme: dark;
  color: #e6eef6;
}

*{box-sizing:border-box}
html,body{height:100%; margin: 0;}
body{
  margin:0;
  background: linear-gradient(180deg,#071021 0%, #08111b 60%);
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  font-size:16px;
  line-height:1.4;
  padding:28px;
  padding-bottom: 60px; /* Extra padding at bottom for scrolling */
  min-height: 100vh;
}

.container{
  width:100%;
  max-width:820px;
  margin:0 auto;
}

h1{ margin:0 0 6px; font-size:1.6rem; }
.lead{ margin:0 0 16px; color:var(--muted); font-size:0.95rem; }

.card{
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
  border-radius: var(--radius);
  padding:16px;
  box-shadow: 0 6px 24px rgba(2,6,23,0.6), inset 0 1px 0 rgba(255,255,255,0.02);
  margin-bottom:16px;
}

.row{ display:flex; flex-direction:column; gap:8px; margin-bottom:12px; }
.row label{ font-weight:600; font-size:0.9rem; }
.row input[type="number"]{
  padding:10px 12px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.04);
  background:var(--glass);
  color:inherit;
  outline:none;
  font-size:1rem;
}

.row input[type="text"]{
  padding:10px 12px;
  border-radius:8px;
  border:1px solid rgba(255,255,255,0.04);
  background:var(--glass);
  color:inherit;
  outline:none;
  font-size:1rem;
}

.input-helper {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 4px;
  font-style: italic;
}

.gem-highlight {
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.15), rgba(96, 165, 250, 0.15));
  border: 1px solid rgba(125, 211, 252, 0.3);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.gem-highlight .gem-amount {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.3);
  display: block;
  margin-bottom: 4px;
}

.gem-highlight .gem-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.saved-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
}

.saved-list li {
  background: rgba(255,255,255,0.02);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  border: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.saved-list li:hover {
  background: rgba(255,255,255,0.04);
  border-color: rgba(125, 211, 252, 0.3);
}

.saved-list .saved-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--accent);
}

.saved-list .saved-details {
  font-size: 0.85rem;
  color: var(--muted);
}

.saved-list .delete-saved {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 100, 100, 0.2);
  border: 1px solid rgba(255, 100, 100, 0.4);
  color: #ff6b6b;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saved-list .delete-saved:hover {
  background: rgba(255, 100, 100, 0.3);
}

.toggle-row{ display:flex; gap:12px; align-items:center; }
.toggle-row label{ cursor:pointer; display:flex; gap:8px; align-items:center; color:var(--muted); font-weight:500; }

.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(125, 211, 252, 0.15);
  color: var(--accent);
  font-size: 11px;
  font-weight: bold;
  cursor: help;
  margin-left: 4px;
  border: 1px solid rgba(125, 211, 252, 0.3);
  transition: all 0.2s ease;
  position: relative;
}

.tooltip-icon:hover {
  background: rgba(125, 211, 252, 0.25);
  border-color: var(--accent);
  transform: scale(1.1);
}

.tooltip-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.98);
  color: #e6eef6;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: normal;
  white-space: normal;
  max-width: 250px;
  width: max-content;
  min-width: 180px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1000;
  border: 1px solid rgba(125, 211, 252, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  line-height: 1.4;
}

.tooltip-icon:hover::after {
  opacity: 1;
  visibility: visible;
}

.tooltip-icon::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(15, 23, 42, 0.98);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, visibility 0.15s ease;
  z-index: 1001;
}

.tooltip-icon:hover::before {
  opacity: 1;
  visibility: visible;
}

.actions{ display:flex; gap:8px; align-items:center; }
.result-actions{ margin-top:12px; }

button{
  background:linear-gradient(180deg,var(--accent),var(--accent-2));
  color:#022235;
  padding:10px 14px;
  border-radius:10px;
  border:none;
  font-weight:700;
  cursor:pointer;
}
button.secondary{
  background:transparent;
  border:1px solid rgba(255,255,255,0.04);
  color:var(--muted);
  box-shadow:none;
}

.hidden{ display:none; }
.muted{ color:var(--muted); }
.summary{ margin:6px 0 12px; font-size:1.05rem; }

/* Progress bar */
.progress-bar{
  width: 100%;
  height: 24px;
  background: rgba(255,255,255,0.03);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.progress-fill{
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.4s ease;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(125, 211, 252, 0.4);
}

/* Breakdown: internal scroll so it doesn't grow the page */
.breakdown{
  list-style:none;
  padding:8px;
  margin:8px 0 0;
  max-height:48vh;
  overflow:auto;
  -webkit-overflow-scrolling: touch;
  border-radius:8px;
  background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(255,255,255,0.00));
}
.breakdown li{
  padding:8px 10px;
  border-radius:8px;
  margin-bottom:6px;
  display:flex;
  justify-content:space-between;
  gap:12px;
  font-family: monospace;
  font-size:0.98rem;
  background: rgba(255,255,255,0.01);
}

/* Responsive */
@media (max-width:520px){
  body{padding:18px; padding-bottom: 50px;}
  .row{margin-bottom:10px}
  button{width:100%}
  .actions{flex-direction:column; align-items:stretch}
}

footer {
  margin-bottom: 20px;
}