/* ======================================================
   GLOBAL RESET & BOX MODEL (WAJIB)
====================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: radial-gradient(1200px 600px at 50% -200px, #1e293b 0%, #020617 60%);
  color: #e5e7eb;
}

/* ======================================================
   LAYOUT
====================================================== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px;
  width: 100%;
}

h1 {
  font-size: 32px;
  margin: 0 0 6px;
}

.subtitle {
  color: #94a3b8;
  margin-bottom: 32px;
}

/* ======================================================
   GRID (DESKTOP)
====================================================== */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ======================================================
   CARD
====================================================== */
.card {
  background: linear-gradient(180deg, #020617 0%, #020617 100%);
  border-radius: 16px;
  padding: 24px;
  box-shadow:
    0 0 0 1px rgba(148,163,184,0.05),
    0 20px 40px rgba(0,0,0,0.4);
  width: 100%;
}

.card.full {
  margin-top: 24px;
}

.card h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 20px;
}

/* ======================================================
   FORM
====================================================== */
label {
  display: block;
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  margin-bottom: 16px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #020617;
  color: #e5e7eb;
  font-size: 16px;
}

input:focus,
select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 1px rgba(37,99,235,0.4);
}

/* ======================================================
   BUTTON
====================================================== */
button {
  width: 100%;
  max-width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  background: #2563eb;
  color: white;
  touch-action: manipulation;
}

button.secondary {
  background: #334155;
}

button:active {
  transform: scale(0.99);
}

/* ======================================================
   SUMMARY
====================================================== */
.result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0;
  font-size: 14px;
}

/* ======================================================
   RISK STATUS
====================================================== */
.safe {
  color: #22c55e;
  font-weight: 700;
}

.warning {
  color: #facc15;
  font-weight: 700;
}

.danger {
  color: #ef4444;
  font-weight: 700;
}

/* ======================================================
   JOURNAL
====================================================== */
.journal {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.journal select {
  flex: 1;
}

.journal button {
  flex: 1;
}

.win {
  background: #16a34a;
}

.loss {
  background: #dc2626;
}

.reset {
  background: #475569;
}

/* ======================================================
   CHART & LOG
====================================================== */
canvas {
  width: 100% !important;
  max-width: 100%;
  height: 300px !important;
  margin-top: 16px;
  background: #020617;
  border-radius: 12px;
}

pre {
  background: #020617;
  padding: 14px;
  border-radius: 12px;
  margin-top: 16px;
  font-size: 13px;
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ======================================================
   MOBILE – REAL FIX (NO OVERFLOW, NO SIDE SCROLL)
====================================================== */
@media (max-width: 768px) {

  body {
    overflow-x: hidden;
  }

  .container {
    max-width: 100%;
    padding: 16px;
    overflow-x: hidden;
  }

  /* FORCE STACK */
  .grid {
    display: block !important;
  }

  .card {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 14px;
    margin-bottom: 24px;
  }

  label {
    font-size: 12px;
  }

  input,
  select,
  button {
    font-size: 16px;
    padding: 14px;
  }

  .journal {
    flex-direction: column;
    gap: 10px;
  }

  canvas {
    height: 240px !important;
  }

  pre {
    font-size: 12px;
    max-height: 180px;
  }
}
