/* src/app/styles.css */
:root {
  color: #172033;
  background: #f7f8fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
}

button {
  font: inherit;
}

.app-shell {
  width: calc(100% - 32px);
  max-width: 960px;
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  min-width: 0;
  margin-bottom: 28px;
}

.eyebrow {
  color: #4f46e5;
  text-transform: uppercase;
  margin: 0 0 8px;
  font-size: .875rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1;
}

.summary {
  color: #46546f;
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 640px;
  margin-bottom: 0;
}

.shell-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.pwa-status {
  display: flex;
  background: #fff;
  border: 1px solid #d7deea;
  border-radius: 8px;
  flex-wrap: wrap;
  align-items:  center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
}

.status-pill {
  color: #14532d;
  background: #dcfce7;
  border: 1px solid #15803d;
  border-radius: 999px;
  margin: 0;
  padding: 4px 10px;
  font-weight: 800;
}

.status-pill.offline {
  color: #7a271a;
  background: #fee4e2;
  border-color: #b42318;
}

.status-copy {
  overflow-wrap: anywhere;
  min-width: 0;
  margin: 0;
}

.compact-update {
  margin-left: auto;
}

.nav-button {
  color: #1f2a44;
  cursor: pointer;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  min-height: 44px;
  padding: 10px 16px;
}

.nav-button:hover {
  outline: 3px solid #312e81;
  outline-offset: 2px;
  border-color: #4f46e5;
}

.nav-button:focus-visible {
  outline: 3px solid #312e81;
  outline-offset: 2px;
  border-color: #4f46e5;
}

.nav-button.active {
  color: #fff;
  background: #4f46e5;
  border-color: #4f46e5;
  box-shadow: inset 0 -4px #facc15;
}

.screen-panel {
  background: #fff;
  border: 1px solid #d7deea;
  border-radius: 8px;
  padding: 24px;
}

.screen-panel h2 {
  margin-bottom: 8px;
}

.screen-panel p {
  color: #46546f;
  margin-bottom: 0;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.primary-action, .secondary-action {
  cursor: pointer;
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 16px;
}

.primary-action:focus-visible {
  outline: 3px solid #312e81;
  outline-offset: 2px;
}

.secondary-action:focus-visible {
  outline: 3px solid #312e81;
  outline-offset: 2px;
}

.primary-action {
  color: #fff;
  background: #4f46e5;
  border: 1px solid #4f46e5;
}

.secondary-action {
  color: #1f2a44;
  background: #fff;
  border: 1px solid #cbd5e1;
}

.primary-action:disabled, .secondary-action:disabled {
  cursor: not-allowed;
  opacity: .55;
}

.inline-error {
  color: #b42318;
  margin-top: 16px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 16px 0 0;
}

.result-grid div {
  min-width: 0;
}

.result-grid dt {
  color: #46546f;
  font-size: .85rem;
  font-weight: 700;
}

.result-grid dd {
  color: #172033;
  margin: 4px 0 0;
  font-weight: 700;
}

.hash-value {
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace;
  font-size: .9rem;
}

.run-header, .section-heading, .slot-item, .upgrade-item {
  display: flex;
  justify-content: space-between;
  align-items:  flex-start;
  gap: 16px;
}

.run-header {
  flex-wrap: wrap;
}

.run-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
  gap: 12px;
  min-width: min(100%, 360px);
  margin: 0;
}

.run-stats div {
  min-width: 0;
}

.run-stats dt {
  color: #46546f;
  font-size: .8rem;
  font-weight: 700;
}

.run-stats dd {
  color: #172033;
  margin: 2px 0 0;
  font-weight: 700;
}

.run-section {
  border-top: 1px solid #e2e8f0;
  margin-top: 24px;
  padding-top: 20px;
}

.run-section h3, .run-section h4 {
  margin: 0;
}

.compact-actions {
  margin-top: 0;
}

.dice-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.die-button {
  display: grid;
  color: #172033;
  text-align: left;
  cursor: pointer;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  gap: 6px;
  min-height: 150px;
  padding: 14px;
}

.die-button:hover {
  outline: 3px solid #312e81;
  outline-offset: 2px;
  border-color: #4f46e5;
}

.die-button:focus-visible {
  outline: 3px solid #312e81;
  outline-offset: 2px;
  border-color: #4f46e5;
}

.die-button[aria-pressed="true"] {
  border-color: #4f46e5;
  box-shadow: inset 0 0 0 2px #4f46e5;
}

.die-button[aria-pressed="true"] .die-state:first-of-type {
  color: #172033;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  font-weight: 800;
}

.die-name, .die-value {
  font-weight: 800;
}

.die-value {
  font-size: 1.4rem;
}

.die-pips, .die-state {
  color: #46546f;
  font-size: .9rem;
}

.slot-list, .upgrade-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.slot-item, .upgrade-item {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px;
}

.slot-item p, .upgrade-item p {
  margin: 6px 0 0;
}

.explanation-list {
  color: #46546f;
  margin: 12px 0 0;
  padding-left: 20px;
}

@media (max-width: 640px) {
  .app-shell {
    width: calc(100% - 20px);
    padding: 24px 0;
  }

  .screen-panel {
    padding: 18px;
  }

  .run-header, .section-heading, .slot-item, .upgrade-item {
    display: grid;
  }

  .run-stats {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root {
    color: #000;
    background: #fff;
  }

  .summary, .die-pips, .die-state, .explanation-list, .result-grid dt, .run-stats dt {
    color: #111;
  }

  .nav-button, .primary-action, .secondary-action, .screen-panel, .die-button, .slot-item, .upgrade-item {
    border-color: #000;
  }
}

@media (forced-colors: active) {
  .nav-button, .primary-action, .secondary-action, .die-button {
    forced-color-adjust: auto;
  }

  .nav-button.active, .die-button[aria-pressed="true"] {
    outline: 2px solid buttontext;
    outline-offset: 2px;
    box-shadow: none;
  }
}
