﻿#math100-app {
  position: relative;
}

#math100-app .wrap {
  border: 1px solid var(--edu-border);
  border-radius: 20px;
  background: var(--edu-surface);
  box-shadow: var(--edu-shadow);
  padding: 16px;
}

#math100-app header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#math100-app .brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

#math100-app .logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(181, 107, 42, 0.35);
  background:
    linear-gradient(135deg, rgba(181, 107, 42, 0.9), rgba(111, 124, 105, 0.92)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.32) 0 4px, rgba(255, 255, 255, 0.08) 4px 8px);
  box-shadow: 0 12px 24px rgba(32, 24, 12, 0.2);
}

#math100-app .math100-title {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(23px, 3vw, 30px);
  line-height: 1.2;
}

#math100-app .math100-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

#math100-app .top-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

#math100-app .pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  border: 1px solid var(--edu-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 13px;
}

#math100-app .pill strong {
  color: var(--ink);
}

#math100-app .grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.8fr);
  align-items: start;
}

#math100-app .card {
  border: 1px solid var(--edu-border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(32, 24, 12, 0.1);
  padding: 16px;
}

#math100-app .card h2 {
  margin: 0 0 10px;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: 24px;
}

#math100-app .muted {
  color: var(--muted);
  line-height: 1.6;
}

#math100-app .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

#math100-app .row.space {
  justify-content: space-between;
}

#math100-app .spacer {
  height: 10px;
}

#math100-app .hr {
  height: 1px;
  background: var(--edu-border);
  margin: 14px 0;
}

#math100-app .menu {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

#math100-app .tile {
  border: 1px solid var(--edu-border);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.99), rgba(239, 229, 216, 0.72));
  text-align: left;
  padding: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.2s ease;
}

#math100-app .tile:hover,
#math100-app .tile:focus-visible {
  transform: translateY(-1px);
  background: linear-gradient(165deg, rgba(255, 255, 255, 1), rgba(231, 216, 196, 0.84));
}

#math100-app .tile h3 {
  margin: 0;
  font-size: 18px;
}

#math100-app .tile p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

#math100-app .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--edu-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 13px;
}

#math100-app .badge strong {
  color: var(--ink);
}

#math100-app .btn {
  border: 1px solid var(--edu-border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

#math100-app .btn:hover,
#math100-app .btn:focus-visible {
  background: #f9f3ea;
}

#math100-app .btn:active {
  transform: translateY(1px);
}

#math100-app .btn.primary {
  background: var(--edu-accent);
  border-color: var(--accent-dark);
  color: #fff;
}

#math100-app .btn.primary:hover,
#math100-app .btn.primary:focus-visible {
  background: var(--accent-dark);
}

#math100-app .btn.good {
  border-color: rgba(46, 125, 82, 0.35);
  background: rgba(46, 125, 82, 0.1);
}

#math100-app .btn.bad {
  border-color: rgba(170, 58, 48, 0.35);
  background: rgba(170, 58, 48, 0.1);
}

#math100-app .btn.small {
  padding: 8px 11px;
  font-size: 13px;
  border-radius: 10px;
}

#math100-app .bigQ {
  margin: 0;
  text-align: center;
  font-family: "Fraunces", "Times New Roman", serif;
  font-size: clamp(34px, 5vw, 48px);
  line-height: 1.12;
}

#math100-app .hint {
  margin: 8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

#math100-app .answerWrap {
  display: grid;
  gap: 10px;
  justify-items: center;
}

#math100-app input[type="number"],
#math100-app input[type="text"],
#math100-app textarea {
  width: min(340px, 100%);
  border: 1px solid var(--edu-border);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 18px;
  padding: 12px;
  font-weight: 700;
}

#math100-app input:focus,
#math100-app textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(181, 107, 42, 0.18);
  border-color: rgba(181, 107, 42, 0.55);
}

#math100-app .choices {
  width: 100%;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

#math100-app .choice {
  border: 1px solid var(--edu-border);
  border-radius: 12px;
  background: #fff;
  text-align: center;
  padding: 12px;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

#math100-app .choice:hover,
#math100-app .choice:focus-visible {
  background: #f9f3ea;
}

#math100-app .choice.correct {
  background: rgba(46, 125, 82, 0.16);
  border-color: rgba(46, 125, 82, 0.45);
}

#math100-app .choice.wrong {
  background: rgba(170, 58, 48, 0.12);
  border-color: rgba(170, 58, 48, 0.45);
}

#math100-app .keypad {
  width: min(340px, 100%);
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#math100-app .key {
  border: 1px solid var(--edu-border);
  border-radius: 11px;
  background: #fff;
  padding: 10px 0;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

#math100-app .key:hover,
#math100-app .key:focus-visible {
  background: #f9f3ea;
}

#math100-app table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--edu-border);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

#math100-app th,
#math100-app td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--edu-border);
  font-size: 14px;
}

#math100-app th {
  color: var(--muted);
  font-weight: 700;
}

#math100-app tr:last-child td {
  border-bottom: none;
}

#math100-app .kpi {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

#math100-app .kpi .box {
  border: 1px solid var(--edu-border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 12px;
}

#math100-app .kpi .box .v {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
}

#math100-app .smallNote {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

#math100-app textarea {
  min-height: 140px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

#math100-app .toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 380px;
  border: 1px solid rgba(42, 36, 28, 0.18);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(32, 24, 12, 0.2);
  padding: 10px 13px;
  font-weight: 600;
  z-index: 30;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

#math100-app .toast.show {
  opacity: 1;
  transform: translateY(0);
}

#math100-app .confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 24;
}

#math100-app .confetti i {
  position: absolute;
  top: -16px;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  opacity: 0;
  animation: math100-fall 980ms linear forwards;
}

@keyframes math100-fall {
  to {
    transform: translateY(105vh) rotate(190deg);
    opacity: 0.15;
  }
}

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

@media (max-width: 720px) {
  #math100-app header {
    flex-direction: column;
    align-items: stretch;
  }

  #math100-app .top-right {
    justify-content: space-between;
  }

  #math100-app .row .btn {
    width: 100%;
    min-height: 45px;
  }

  #math100-app .choices {
    grid-template-columns: 1fr;
  }

  #math100-app .toast {
    left: 12px;
    right: 12px;
    max-width: none;
  }
}
