:root {
  --bg: #ffffff;
  --text: #000000;
  --border: #000000;
  --highlight: #f0f0f0;
  --result-bg: #f8f8f8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --text: #ffffff;
    --border: #ffffff;
    --highlight: #222222;
    --result-bg: #111111;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.4;
  padding: 10px;
  max-width: 800px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.8rem;
  font-weight: 700;
}

.dice-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

@media (max-width: 500px) {
  .dice-container {
    grid-template-columns: 1fr;
  }
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

label {
  font-size: 0.9rem;
  font-weight: 500;
}

select, input, button {
  padding: 10px;
  background-color: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-size: 1rem;
  font-family: inherit;
  border-radius: 4px;
}

select:focus, input:focus {
  outline: none;
  background-color: var(--highlight);
}

button {
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.2s;
}

button:hover {
  background-color: var(--highlight);
}

button:active {
  transform: translateY(1px);
}

.roll-button {
  grid-column: span 2;
  padding: 15px;
  font-size: 1.2rem;
  margin-top: 10px;
}

@media (max-width: 500px) {
  .roll-button {
    grid-column: span 1;
  }
}

.result-container {
  margin: 20px 0;
  padding: 15px;
  background-color: var(--result-bg);
  border-radius: 4px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.result-formula {
  font-weight: 600;
}

.result-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.history-container {
  margin-top: 30px;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--border);
}

.history-list {
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  padding: 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  cursor: pointer;
}

.history-item:hover {
  background-color: var(--highlight);
}

.history-formula {
  font-weight: 500;
}

.history-time {
  font-size: 0.8rem;
  opacity: 0.7;
}

.dice-details {
  font-size: 0.9rem;
  opacity: 0.8;
}

.clear-button {
  padding: 5px 10px;
  font-size: 0.8rem;
}

.empty-state {
  text-align: center;
  padding: 20px;
  opacity: 0.6;
}

.install-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--highlight);
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  z-index: 1000;
}

.install-button {
  padding: 8px 15px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
}

.install-button:hover {
  background-color: var(--highlight);
}
