:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #ffffff;
  --ink: #1c2024;
  --muted: #687078;
  --line: #dce0e5;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(28, 32, 36, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f7f2e8 0%, #edf6f4 48%, #f6f8fb 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 24px;
  align-items: start;
}

.workspace,
.history {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(220, 224, 229, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.workspace {
  padding: 28px;
}

.headline {
  margin-bottom: 24px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 6vw, 56px);
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.headline p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.calculator {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.13);
}

.result {
  min-height: 106px;
  border: 1px solid #c8ddd9;
  border-radius: 8px;
  padding: 18px;
  background: #eef8f6;
  display: grid;
  gap: 8px;
}

.result span {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 750;
}

.result strong {
  font-size: clamp(32px, 7vw, 48px);
  line-height: 1;
  overflow-wrap: anywhere;
}

.actions,
.history-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.actions {
  flex-wrap: wrap;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 750;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

.secondary {
  background: #e9eef2;
  color: var(--ink);
}

.secondary:hover {
  background: #dce3e8;
}

.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f1c3bd;
}

.danger:hover {
  background: #fff1ef;
}

.history {
  padding: 24px;
}

.history-header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.empty {
  padding: 28px 0;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--line);
}

.records {
  display: grid;
  gap: 12px;
}

.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  display: grid;
  gap: 12px;
}

.record-main {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.record-rate {
  font-size: 26px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.record-source {
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.chip {
  border-radius: 999px;
  background: #f1f4f6;
  padding: 5px 9px;
}

.delete-record {
  min-width: 44px;
  padding: 0 12px;
}

@media (max-width: 840px) {
  .app {
    grid-template-columns: 1fr;
    padding: 24px 0;
  }
}

@media (max-width: 520px) {
  .app {
    width: min(100% - 20px, 1120px);
  }

  .workspace,
  .history {
    padding: 18px;
  }

  .history-header,
  .record-main {
    align-items: stretch;
    flex-direction: column;
  }

  .danger,
  .delete-record {
    width: 100%;
  }
}
