:root {
  color: #111;
  background: #fff;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
}

h1,
h2,
p {
  margin: 0;
}

canvas {
  display: block;
  max-width: 100%;
}

main {
  width: min(100% - 2rem, 64rem);
  margin: 0 auto;
  padding: 1.5rem 0 1rem;
}

header {
  margin-bottom: 2rem;
}

h1 {
  font-size: 1rem;
}

header p,
footer {
  color: #666;
}

header p {
  margin-top: 0.2rem;
}

.label {
  color: #666;
  font-size: 0.875rem;
}

.total {
  margin: 0.05em 0;
  font-size: clamp(3.5rem, 10vw, 6.5rem);
  font-weight: 500;
  letter-spacing: -0.075em;
  line-height: 1;
}

.change {
  min-height: 1.5em;
}

.history {
  margin-top: 2rem;
}

h2 {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.chart-container {
  position: relative;
  width: 100%;
  height: clamp(18rem, 24vw, 21rem);
}

table {
  width: 100%;
  margin-top: 2rem;
  border-collapse: collapse;
}

th,
td {
  padding: 0.5rem 0;
  border-bottom: 1px solid #ddd;
  text-align: right;
  vertical-align: top;
}

th {
  color: #666;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

th:first-child,
td:first-child {
  text-align: left;
}

.company {
  display: block;
  color: #666;
  font-size: 0.75rem;
}

.investment {
  color: #b45309;
}

tbody tr:nth-child(2) .investment {
  color: #3f7d20;
}

tbody tr:nth-child(3) .investment {
  color: #2563eb;
}

tbody tr:nth-child(4) .investment {
  color: #9333ea;
}

.chart-column {
  width: 9.5rem;
  padding-left: 1.5rem;
}

.mini-chart {
  position: relative;
  width: 8rem;
  height: 2.5rem;
  margin-left: auto;
}

footer {
  margin-top: 1rem;
  font-size: 0.75rem;
}

@media (max-width: 32rem) {
  main {
    padding-top: 1rem;
  }

  header {
    margin-bottom: 2rem;
  }

  .total {
    font-size: 4rem;
  }

  table {
    margin-top: 2rem;
  }

  .history {
    margin-top: 2rem;
  }

  .chart-container {
    height: 13rem;
  }

  .cost-column {
    display: none;
  }

  .chart-column,
  .mini-chart {
    width: 5rem;
  }

  .chart-column {
    padding-left: 0.75rem;
  }

  .company {
    max-width: 8rem;
  }
}
