:root {
  --ink: #f6f4ee;
  --text: #1d252b;
  --muted: #69757d;
  --line: #d7ddd8;
  --surface: #ffffff;
  --surface-soft: #f3f5f1;
  --dark: #16212a;
  --teal: #17736f;
  --amber: #d49235;
  --red: #b8544f;
  --shadow: 0 18px 45px rgba(22, 33, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: #e8ece6;
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
label.file-button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 14px auto 32px;
}

.hero {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--dark);
  box-shadow: var(--shadow);
}

.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(12, 19, 24, 0.88), rgba(12, 19, 24, 0.34), rgba(12, 19, 24, 0.08));
}

.hero__content {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  padding: 34px;
  color: var(--ink);
}

.kicker,
.muted,
.entry-card__date {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.hero .kicker {
  color: #d6e9e4;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 8px 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero__copy {
  margin: 0;
  max-width: 32rem;
  color: #edf4ef;
  font-size: 1.04rem;
  line-height: 1.5;
}

.toolbar,
.panel,
.entry-form,
.summary-strip,
.entry-card,
.game-form {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr minmax(160px, 210px) 44px 44px;
  gap: 10px;
  align-items: center;
  margin: 14px 0;
  padding: 10px;
  border-radius: 8px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.search-field span {
  color: var(--teal);
  font-size: 1.2rem;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.search-field input {
  height: 42px;
  border: 0;
  background: transparent;
}

select,
input {
  min-height: 42px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 10px;
  line-height: 1.4;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(23, 115, 111, 0.14);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--dark);
  color: var(--ink);
  font-size: 1.25rem;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  align-items: start;
}

.panel {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

h2 {
  margin: 0;
  font-size: 1.2rem;
}

.game-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 12px;
  padding: 8px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.game-form[hidden],
.empty-state[hidden],
#deleteGameButton[hidden] {
  display: none;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: var(--teal);
  color: white;
  font-weight: 700;
}

.small-button {
  background: var(--dark);
}

.ghost-button,
.entry-card__actions button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.danger-button,
.delete-entry {
  background: var(--red);
  color: white;
}

.game-list {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.game-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.game-item.is-active {
  border-color: var(--teal);
  background: #e8f2ef;
}

.game-item__name {
  font-weight: 800;
}

.game-item__count {
  flex: 0 0 auto;
  min-width: 2.1rem;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--dark);
  color: var(--ink);
  text-align: center;
  font-size: 0.82rem;
}

.log-heading {
  align-items: flex-start;
}

.entry-form {
  display: grid;
  gap: 14px;
  margin: 14px;
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: #3b474f;
  font-size: 0.88rem;
  font-weight: 700;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 10px;
  border-radius: 8px;
}

.summary-strip span,
.badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: #eef3f1;
  color: #26343b;
  font-size: 0.82rem;
  font-weight: 800;
}

.entry-list {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.entry-card {
  border-radius: 8px;
  padding: 14px;
}

.entry-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entry-card h3 {
  margin: 4px 0 0;
  font-size: 1.1rem;
}

.entry-card__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.badge--high {
  background: #fff1d7;
  color: #7b4b04;
}

.badge--low {
  background: #eef0f4;
  color: #4d5861;
}

.badge--next {
  background: #dff1ef;
  color: #0d5c58;
}

.badge--done {
  background: #e9efe4;
  color: #45622a;
}

.entry-card__goal {
  margin: 12px 0 0;
  font-weight: 800;
}

.entry-card__notes {
  margin: 8px 0 0;
  color: #46545c;
  line-height: 1.45;
  white-space: pre-wrap;
}

.entry-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 1180px);
    margin-top: 9px;
  }

  .hero {
    min-height: 220px;
  }

  .hero__content {
    padding: 24px;
  }

  .toolbar {
    grid-template-columns: 1fr 44px 44px;
  }

  .toolbar select {
    grid-column: 1 / -1;
  }

  .layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .games-panel {
    order: 2;
  }

  .log-panel {
    order: 1;
  }
}

@media (max-width: 520px) {
  .hero {
    min-height: 190px;
  }

  .hero__shade {
    background: rgba(12, 19, 24, 0.68);
  }

  .panel__header,
  .entry-card__top,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .entry-card__badges {
    justify-content: flex-start;
  }

  .form-actions button,
  .entry-card__actions button,
  #deleteGameButton {
    width: 100%;
  }
}
