:root {
  --bg: #0b0f1a;
  --card: #12172a;
  --display: #050814;
  --text: #ffffff;
  --accent: #7cfffb;
  --btn: #141a33;
  --btn2: #0c1022;
}
body.light {
  --bg: #f4f6fb;
  --card: #ffffff;
  --display: #eef1f7;
  --text: #0b0f1a;
  --accent: #5b5bff;
  --btn: #f0f2f8;
  --btn2: #e2e6f2;
}
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Segoe UI, Inter, sans-serif;
  color: var(--text);
}

.app {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  padding: 16px;
}

/* ---------- CALCULATOR ---------- */
.calc {
  width: 520px;
  background: var(--card);
  border-radius: 24px;
  padding: 22px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

#display {
  width: 100%;
  height: 72px;
  border: none;
  border-radius: 18px;
  padding: 14px;
  font-size: 30px;
  background: var(--display);
  color: var(--accent);
  margin-bottom: 16px;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

button {
  height: 56px;
  border: none;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  background: linear-gradient(145deg, var(--btn), var(--btn2));
  color: var(--text);
}
button:hover {
  background: var(--accent);
  color: #000;
}
.equal {
  grid-column: span 2;
  background: var(--accent);
  color: #000;
}

/* ---------- AI ---------- */
.ai {
  width: 420px;
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  display: none;
  flex-direction: column;
}

.ai-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.chat {
  flex: 1;
  background: var(--display);
  border-radius: 16px;
  padding: 12px;
  overflow-y: auto;
  font-size: 14px;
}

.msg {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 14px;
  max-width: 85%;
  white-space: pre-line;
}
.user {
  background: var(--accent);
  color: #000;
  margin-left: auto;
}
.ai-msg {
  background: rgba(255, 255, 255, 0.12);
}

.ai-input {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.ai-input input {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 10px;
  background: var(--display);
  color: var(--text);
}
.small {
  font-size: 13px;
  opacity: 0.7;
  margin-top: 6px;
}
.clear-btn {
  margin-top: 8px;
  height: 40px;
  border-radius: 14px;
  background: #ff5c5c;
  color: #fff;
}
