:root {
  --ink: #111111;
  --muted: #5f6368;
  --line: #d8d8d8;
  --paper: #ffffff;
  --surface: #f6f7f8;
  --tile: #efefe6;
  --tile-hover: #e4e4da;
  --green: #2f7d59;
  --green-soft: #d8ead4;
  --red: #b54747;
  --red-soft: #f3d5d5;
  --blue: #346eb6;
  --blue-soft: #d7e7f7;
  --gold: #8f6a11;
  --gold-soft: #f5df9e;
  --purple-soft: #d8d3ec;
  --teal-soft: #cde8e3;
  --orange-soft: #f0c49f;
  --rose-soft: #efd4df;
  --slate-soft: #d9dee7;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.5rem;
  width: 100%;
  margin: 2rem 0 0;
  padding: 0.55rem clamp(1rem, 4vw, 3rem) 0.45rem 0;
  box-sizing: border-box;
}

.app-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 100vw;
  border-bottom: 1px solid #000000;
  transform: translateX(-50%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-left: 25vw;
}

.brand-link {
  display: inline-flex;
  flex: 0 0 auto;
}

.brand-mark {
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: 0;
  box-shadow: none;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h2 {
  font-size: 1rem;
  line-height: 1.35;
}

.grammardle-title-bar h1 {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  margin: 0;
  letter-spacing: 0;
  line-height: 1;
}

.pz-game-title {
  color: var(--ink);
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  font-style: normal;
  font-weight: 900;
}

.pz-game-date {
  color: var(--muted);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.5vw, 2.1rem);
  font-weight: 400;
  white-space: nowrap;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  margin-left: auto;
  padding: 0.25rem;
  border: 1px solid #111111;
  border-radius: 6px;
  background: var(--paper);
}

.tab {
  min-width: 5.5rem;
  border: 0;
  border-radius: 4px;
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.tab.is-active {
  color: #ffffff;
  background: #111111;
  box-shadow: none;
}

main {
  width: min(820px, calc(100% - 2rem));
  height: calc(100vh - 6.4rem);
  margin: 0 auto;
  overflow: hidden;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  height: 100%;
  overflow: hidden;
}

.panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.exercise-panel,
.archive-panel {
  padding: 0.65rem 0;
  max-height: 100%;
  overflow: hidden;
}

#practice-view.is-active,
#sentence-view.is-active,
#archive-view.is-active {
  overflow-y: auto;
  padding-right: 0.35rem;
}

#practice-view .exercise-panel,
#sentence-view .exercise-panel,
#archive-view .archive-panel {
  max-height: none;
  overflow: visible;
  padding-bottom: 2rem;
}

#practice-view .exercise-panel,
#sentence-view .exercise-panel {
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  row-gap: 0.85rem;
  min-height: 100%;
  padding-top: 60px;
}

#practice-view .category-panel,
#sentence-view .category-panel {
  margin-top: 76px;
  margin-bottom: 0;
}

#practice-view .practice-actions,
#sentence-view .practice-actions {
  margin-top: 0;
}

#practice-view .result-box,
#sentence-view .result-box {
  margin-top: 0;
}

.category-panel {
  margin-bottom: 0.5rem;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.45rem;
}

#practice-view .panel-heading {
  justify-content: center;
  text-align: center;
}

.panel-heading.compact {
  margin-bottom: 0.75rem;
}

.category-heading {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
  text-align: center;
}

.category-heading h2 {
  font-size: 1rem;
}

label {
  color: #344054;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #c9c9c2;
  border-radius: 6px;
  padding: 0.5rem 0.65rem;
  color: var(--ink);
  background: var(--paper);
}

textarea {
  resize: vertical;
}

.sentence-card {
  margin-bottom: 0;
}

.sentence-display {
  display: grid;
  gap: 0.35rem;
}

.sentence-attribution {
  justify-self: end;
  max-width: min(100%, 34rem);
  color: var(--muted);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-style: italic;
  line-height: 1.25;
  text-align: right;
}

.sentence-attribution[hidden] {
  display: none;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-height: 2.2rem;
  align-items: center;
  justify-content: flex-start;
}

.word-bank::before {
  content: "";
  flex: 0 0 1.75rem;
  height: 1px;
}

.word-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.1rem;
  border: 0;
  border-radius: 6px;
  padding: 0.25rem 0.6rem;
  color: #000000;
  background: var(--tile);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 1.08rem;
  font-weight: 850;
  text-align: center;
  box-shadow: var(--shadow);
}

.word-tile:hover {
  background: var(--tile-hover);
}

.word-tile.is-selected {
  color: #000000;
  background: #d7d7cf;
  outline: 3px solid rgba(17, 17, 17, 0.18);
}

.word-tile.is-placed {
  color: #000000;
  background: #d7d7cf;
}

.word-tile.is-correct {
  border-color: var(--green);
  background: var(--green-soft);
}

.word-tile.is-incorrect {
  border-color: var(--red);
  color: #000000;
  background: var(--red-soft);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  align-items: stretch;
}

.category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3.55rem;
  border: 0;
  border-radius: 6px;
  padding: 0.5rem;
  background: var(--gold-soft);
  text-align: center;
  box-shadow: var(--shadow);
}

.category-card:focus,
.category-card:hover {
  filter: brightness(0.97);
}

.category-card:nth-child(2) {
  background: var(--green-soft);
}

.category-card:nth-child(3) {
  background: var(--blue-soft);
}

.category-card:nth-child(4) {
  background: var(--purple-soft);
}

.category-card:nth-child(5) {
  background: var(--teal-soft);
}

.category-card:nth-child(6) {
  background: var(--orange-soft);
}

.category-card:nth-child(7) {
  background: var(--rose-soft);
}

.category-card:nth-child(8) {
  background: var(--slate-soft);
}

.category-card:nth-child(9) {
  background: #e7e0b8;
}

.category-card h3 {
  width: 100%;
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-align: center;
}

.category-contents {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
  width: 100%;
  align-items: stretch;
  justify-items: center;
}

.category-contents:empty {
  display: none;
}

.mini-tile {
  width: 100%;
  border-radius: 4px;
  padding: 0.16rem 0.3rem;
  background: rgba(255, 255, 255, 0.44);
  color: #111111;
  font-size: 0.72rem;
  font-weight: 800;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sentence-view .category-contents {
  grid-template-columns: 1fr;
}

#sentence-view .mini-tile {
  line-height: 1.2;
  white-space: normal;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.55rem;
}

.practice-actions {
  justify-content: center;
}

.attempts-action,
.primary-action,
.secondary-action {
  border-radius: 999px;
  padding: 0.48rem 0.85rem;
  font-weight: 800;
}

.attempts-action {
  border: 1px solid #c9c9c2;
  color: #111111;
  background: #f5f5ef;
  cursor: default;
}

.primary-action {
  border: 1px solid #111111;
  color: #ffffff;
  background: #111111;
}

.secondary-action {
  border: 1px solid #111111;
  color: #111111;
  background: var(--paper);
}

.result-box {
  margin-top: 0.45rem;
  min-height: 1.15rem;
  color: var(--muted);
  font-weight: 700;
}

.result-box.has-review {
  display: grid;
  gap: 0.45rem;
  width: min(100%, 780px);
  margin-right: auto;
  margin-left: auto;
  text-align: left;
}

.feedback-summary,
.feedback-heading,
.feedback-title,
.feedback-copy {
  margin: 0;
}

.feedback-heading {
  color: #111111;
  font-size: 0.88rem;
  font-weight: 900;
}

.feedback-list {
  display: grid;
  gap: 0.4rem;
}

.feedback-item {
  border-left: 3px solid var(--red);
  border-radius: 4px;
  padding: 0.45rem 0.55rem;
  color: #111111;
  background: rgba(255, 255, 255, 0.66);
}

.feedback-title {
  font-size: 0.88rem;
  font-weight: 900;
}

.feedback-copy {
  margin-top: 0.14rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.feedback-copy strong {
  color: #111111;
  font-weight: 900;
}

.result-box.success {
  color: var(--green);
}

.result-box.warning {
  color: var(--gold);
}

.result-box.error {
  color: var(--red);
}

.archive-list {
  display: grid;
  gap: 0.75rem;
}

.archive-date-group {
  display: grid;
  gap: 0.5rem;
}

.archive-date-label {
  font-size: 0.95rem;
  font-weight: 900;
}

.archive-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: #fbfcff;
}

.archive-copy {
  min-width: 0;
}

.archive-sentence {
  color: var(--ink);
  font-weight: 750;
  line-height: 1.35;
}

.archive-attribution {
  margin-top: 0.25rem;
  color: var(--muted);
  font-family: "Lora", Georgia, "Times New Roman", serif;
  font-size: 0.92rem;
  font-style: italic;
}

.archive-practice {
  white-space: nowrap;
}

@media (max-width: 900px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .app-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    width: min(820px, calc(100% - 2rem));
    margin-right: auto;
    margin-left: auto;
    padding-right: 0;
  }

  .brand-lockup {
    margin-left: 0;
  }

  .tabs {
    width: 100%;
    margin-left: 0;
  }

  main {
    height: auto;
    min-height: calc(100vh - 8.5rem);
    overflow: visible;
  }

  .view.is-active,
  .exercise-panel,
  .archive-panel {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #practice-view .exercise-panel,
  #sentence-view .exercise-panel {
    min-height: 0;
    padding-top: 32px;
  }

  #practice-view .category-panel,
  #sentence-view .category-panel {
    margin-top: 40px;
  }

  .brand-mark {
    width: 2.6rem;
    height: 2.6rem;
  }

  .category-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  main,
  .app-header {
    width: min(100% - 1rem, 1180px);
  }

  .app-header {
    margin-top: 0.75rem;
  }

  .brand-lockup {
    gap: 0.5rem;
  }

  .brand-mark {
    width: 2.2rem;
    height: 2.2rem;
  }

  .pz-game-title {
    font-size: clamp(1.28rem, 6.4vw, 1.55rem);
  }

  .pz-game-date {
    font-size: clamp(1.06rem, 5.4vw, 1.35rem);
  }

  .grammardle-title-bar h1 {
    gap: 0.35rem;
    flex-wrap: nowrap;
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }

  .category-card {
    min-height: 3.25rem;
    padding: 0.45rem;
  }

  .category-card h3 {
    font-size: 0.78rem;
  }

  .category-contents {
    grid-template-columns: 1fr;
  }

  .word-bank {
    gap: 0.3rem;
  }

  .word-bank::before {
    flex-basis: 1rem;
  }

  .sentence-attribution {
    max-width: 100%;
    font-size: 0.94rem;
  }

  .word-tile {
    min-height: 2rem;
    padding: 0.22rem 0.52rem;
  }

  #practice-view .exercise-panel,
  #sentence-view .exercise-panel {
    padding-top: 22px;
    row-gap: 0.75rem;
  }

  #practice-view .category-panel,
  #sentence-view .category-panel {
    margin-top: 24px;
  }

  .category-heading h2 {
    font-size: 0.95rem;
  }

  .practice-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .attempts-action,
  .primary-action,
  .secondary-action {
    width: 100%;
    padding: 0.56rem 0.7rem;
  }

  .result-box.has-review {
    font-size: 0.92rem;
  }

  .feedback-item {
    padding: 0.4rem 0.5rem;
  }

  .panel-heading,
  .archive-item {
    grid-template-columns: 1fr;
    display: grid;
  }

  .archive-practice {
    width: 100%;
  }
}
