:root {
  --navy: #062c43;
  --deep-teal: #0b6170;
  --teal: #10808e;
  --sky: #b9edf0;
  --gold: #d6a847;
  --light-gold: #f8e7a6;
  --cream: #fffaf0;
  --ink: #15232d;
  --muted: #52616b;
  --panel: rgba(255, 250, 240, 0.94);
  --line: rgba(6, 44, 67, 0.16);
}

body {
  font-family: Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 250, 240, 0.84), rgba(255, 250, 240, 0.92)),
    url("community-sky.svg") center top / cover fixed,
    var(--cream);
  color: var(--ink);
}

header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.8rem 2rem;
  background:
    linear-gradient(135deg, rgba(6, 44, 67, 0.98), rgba(11, 97, 112, 0.94));
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 8px 28px rgba(6, 44, 67, 0.24);
  color: white;
}

header a,
header button {
  color: white;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04rem;
  text-decoration: none;
}

.brand img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--light-gold);
  box-shadow: 0 0 0 3px rgba(248, 231, 166, 0.2);
}

nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

main {
  max-width: 960px;
  margin: 2.25rem auto;
  padding: 0 1rem;
}

.app-layout {
  align-items: start;
  display: grid;
  gap: 1rem;
  grid-template-columns: 240px minmax(0, 960px) minmax(260px, 1fr);
  margin: 2.25rem 1rem;
  max-width: 1680px;
}

.app-layout main {
  margin: 0;
  max-width: none;
  padding: 0;
}

h1 {
  color: var(--navy);
  margin-top: 0;
}

h2 {
  color: var(--deep-teal);
}

a {
  color: var(--deep-teal);
}

.actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.button,
button {
  border: 0;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--deep-teal), var(--teal));
  color: white;
  cursor: pointer;
  display: inline-block;
  font: inherit;
  font-weight: 700;
  padding: 0.65rem 0.9rem;
  text-decoration: none;
  box-shadow: 0 7px 16px rgba(6, 44, 67, 0.18);
}

.button:hover,
button:hover {
  background: linear-gradient(135deg, #0f7180, #d6a847);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(6, 44, 67, 0.14);
  padding: 1.25rem;
  backdrop-filter: blur(4px);
}

.panel + .panel {
  margin-top: 1rem;
}

.hero-panel {
  align-items: center;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
  position: relative;
}

.hero-panel:before {
  content: "";
  position: absolute;
  inset: auto -10% -54px 12%;
  height: 120px;
  border-top: 8px solid rgba(214, 168, 71, 0.38);
  border-radius: 50%;
  transform: rotate(-7deg);
}

.hero-panel > * {
  position: relative;
}

.hero-badge {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 5px solid var(--light-gold);
  box-shadow: 0 14px 34px rgba(6, 44, 67, 0.28);
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.55;
  max-width: 640px;
}

.app-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 1rem;
}

.app-card {
  background: linear-gradient(160deg, rgba(255, 250, 240, 0.98), rgba(185, 237, 240, 0.72));
  border: 1px solid rgba(11, 97, 112, 0.18);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(6, 44, 67, 0.12);
  color: var(--ink);
  display: block;
  min-height: 110px;
  padding: 1rem;
  padding-right: 4.35rem;
  position: relative;
  text-decoration: none;
}

.app-card:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.app-card strong {
  color: var(--navy);
  display: block;
  font-size: 1.12rem;
  margin-bottom: 0.35rem;
}

.app-card span {
  color: var(--muted);
  line-height: 1.45;
}

.app-card-icon {
  height: 42px;
  object-fit: contain;
  opacity: 0.9;
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 42px;
}

.presence-sidebar {
  position: sticky;
  top: 1rem;
}

.presence-sidebar h2 {
  font-size: 1rem;
  margin: 0 0 0.85rem;
}

.presence-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.presence-list li {
  align-items: center;
  display: flex;
  gap: 0.5rem;
  line-height: 1.35;
  padding: 0.35rem 0;
}

.presence-list li:before {
  background: #16a34a;
  border-radius: 50%;
  content: "";
  flex: 0 0 0.55rem;
  height: 0.55rem;
  width: 0.55rem;
}

.presence-list .offline-user {
  color: #7b8790;
}

.presence-list .offline-user:before {
  background: #a8b0b7;
}

.presence-separator {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.65rem 0;
}

.empty-presence {
  color: var(--muted);
  margin: 0;
}

.right-rail {
  display: grid;
  gap: 1rem;
  position: sticky;
  top: 1rem;
}

.rail-panel h2 {
  font-size: 1rem;
  margin: 0 0 0.85rem;
}

.photo-of-day {
  overflow: hidden;
}

.photo-of-day-trigger {
  background: transparent;
  border: 0;
  box-shadow: none;
  cursor: zoom-in;
  display: block;
  padding: 0;
  width: 100%;
}

.photo-of-day-trigger:hover {
  background: transparent;
}

.photo-of-day img,
.photo-lightbox-image {
  border-radius: 8px;
  display: block;
  -webkit-touch-callout: none;
  user-select: none;
}

.photo-of-day img {
  max-height: 360px;
  object-fit: cover;
  width: 100%;
}

.photo-lightbox-backdrop {
  align-items: center;
  background: rgba(6, 44, 67, 0.88);
  display: none;
  inset: 0;
  justify-content: center;
  padding: 5vh 5vw;
  position: fixed;
  z-index: 1200;
}

.photo-lightbox-backdrop.is-open {
  display: flex;
}

.photo-lightbox {
  align-items: center;
  display: flex;
  height: 90vh;
  justify-content: center;
  position: relative;
  width: 90vw;
}

.photo-lightbox-image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  height: 90vh;
  pointer-events: none;
  width: 90vw;
}

.photo-lightbox-close {
  align-items: center;
  background: rgba(255, 250, 240, 0.94);
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 8px 22px rgba(6, 44, 67, 0.28);
  color: var(--navy);
  display: flex;
  font-size: 1.35rem;
  height: 2.4rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: -0.4rem;
  top: -0.4rem;
  width: 2.4rem;
}

body.photo-lightbox-open {
  overflow: hidden;
}

.announcement-composer {
  margin-bottom: 0.75rem;
}

.announcement-composer summary {
  background: linear-gradient(135deg, var(--deep-teal), var(--teal));
  border-radius: 6px;
  box-shadow: 0 5px 12px rgba(6, 44, 67, 0.14);
  color: white;
  cursor: pointer;
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  list-style: none;
  padding: 0.42rem 0.62rem;
}

.announcement-composer summary::-webkit-details-marker {
  display: none;
}

.announcement-composer[open] summary {
  margin-bottom: 0.55rem;
}

.announcement-form {
  display: grid;
  gap: 0.45rem;
}

.announcement-form textarea {
  font-size: 0.88rem;
  max-width: none;
  min-height: 4.25rem;
  padding: 0.45rem;
  resize: vertical;
}

.announcement-form button {
  font-size: 0.82rem;
  justify-self: start;
  padding: 0.42rem 0.62rem;
}

.announcement-list {
  display: grid;
  gap: 0.7rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.announcement-item {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(11, 97, 112, 0.14);
  border-radius: 8px;
  padding: 0.65rem;
}

.announcement-item p {
  font-size: 0.9rem;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.announcement-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 0.82rem;
  gap: 0.5rem;
  justify-content: space-between;
  margin-top: 0.65rem;
}

.announcement-meta form {
  margin: 0;
}

.announcement-delete {
  background: transparent;
  box-shadow: none;
  color: #9f1239;
  font-size: 0.76rem;
  padding: 0;
  text-decoration: underline;
}

.announcement-delete:hover {
  background: transparent;
  color: #dc2626;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.secondary-button {
  background: linear-gradient(135deg, #6b5a34, #9c7a2f);
}

.danger-button {
  background: linear-gradient(135deg, #9f1239, #dc2626);
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.error {
  color: #b91c1c;
  font-weight: 700;
}

label {
  display: block;
  font-weight: 700;
  margin-top: 0.75rem;
}

input {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(6, 44, 67, 0.22);
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  max-width: 360px;
  padding: 0.5rem;
  width: 100%;
}

input[type="checkbox"],
input[type="radio"] {
  margin-right: 0.35rem;
  max-width: none;
  width: auto;
}

select {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(6, 44, 67, 0.22);
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  max-width: 360px;
  padding: 0.5rem;
  width: 100%;
}

textarea {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(6, 44, 67, 0.22);
  border-radius: 6px;
  box-sizing: border-box;
  font: inherit;
  max-width: 640px;
  padding: 0.5rem;
  width: 100%;
}

ul {
  padding-left: 1.25rem;
}

.checkbox-list {
  list-style: none;
  margin: 0.5rem 0 1rem;
  padding: 0;
}

.checkbox-list label {
  display: inline-flex;
  align-items: center;
  font-weight: 400;
  margin: 0.25rem 0;
}

.choice-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.choice-row label {
  display: inline;
  font-weight: 400;
  margin: 0;
}

.inline-form {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.inline-form button {
  margin-top: 0.25rem;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.6rem;
  text-align: left;
}

th {
  color: var(--navy);
}

.messages {
  list-style: none;
  padding: 0;
}

.messages li {
  background: #e8f8ea;
  border: 1px solid #8bcf91;
  border-radius: 6px;
  margin-bottom: 0.75rem;
  padding: 0.75rem;
}

.logout-form {
  display: inline;
}

.logout-form button {
  background: transparent;
  box-shadow: none;
  padding: 0;
  text-decoration: underline;
}

.cookie-modal-backdrop {
  align-items: center;
  background: rgba(6, 44, 67, 0.68);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 1rem;
  position: fixed;
  z-index: 1000;
}

.cookie-modal {
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(6, 44, 67, 0.32);
  max-width: 430px;
  padding: 1.25rem;
  width: 100%;
}

.cookie-modal h2 {
  font-size: 1.15rem;
  margin-top: 0;
}

.cookie-modal p {
  color: var(--muted);
  line-height: 1.45;
}

.cookie-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 1rem;
}

.poll-results {
  display: grid;
  gap: 0.85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.poll-result-row {
  display: grid;
  gap: 0.35rem;
}

.poll-result-topline {
  align-items: baseline;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
}

.poll-choice-text {
  color: var(--ink);
  font-weight: 700;
}

.poll-vote-count {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.poll-meter {
  display: block;
  height: 0.8rem;
  width: 100%;
}

.poll-meter::-webkit-meter-bar {
  background: rgba(6, 44, 67, 0.1);
  border: 1px solid rgba(6, 44, 67, 0.14);
  border-radius: 999px;
}

.poll-meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg, var(--deep-teal), var(--gold));
  border-radius: 999px;
}

.poll-meter::-moz-meter-bar {
  background: linear-gradient(90deg, var(--deep-teal), var(--gold));
  border-radius: 999px;
}

.poll-summary {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

.pfztasks-page h1 {
  font-size: 1.55rem;
  margin-bottom: 1rem;
}

.pfztasks-page h2 {
  font-size: 1.1rem;
  margin-bottom: 0.8rem;
}

.pfztasks-toolbar {
  padding: 0.85rem 1rem;
}

.pfztasks-button,
.pfztasks-page .task-actions button,
.pfztasks-page .task-actions .button {
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(6, 44, 67, 0.14);
  font-size: 0.85rem;
  line-height: 1.1;
  min-width: 5.5rem;
  padding: 0.42rem 0.62rem;
  text-align: center;
}

.task-list {
  display: grid;
  gap: 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-item {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 8rem;
  padding: 0.8rem;
}

.task-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.8rem;
  gap: 0.45rem;
}

.task-priority {
  background: rgba(214, 168, 71, 0.18);
  border: 1px solid rgba(214, 168, 71, 0.35);
  border-radius: 999px;
  color: var(--navy);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  text-transform: uppercase;
}

.task-description {
  font-size: 0.92rem;
  line-height: 1.38;
  margin: 0;
}

.task-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.2rem;
}

.task-actions form {
  margin: 0;
}

.tictactoe-page {
  display: grid;
  gap: 1rem;
}

.tictactoe-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.tictactoe-header h1 {
  margin-bottom: 0.35rem;
}

.tictactoe-header .lead {
  margin: 0;
}

.tictactoe-status {
  background: rgba(185, 237, 240, 0.62);
  border: 1px solid rgba(11, 97, 112, 0.18);
  border-radius: 8px;
  color: var(--navy);
  font-weight: 700;
  margin: 0;
  padding: 0.75rem;
}

.tictactoe-board {
  aspect-ratio: 1;
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, 1fr);
  max-width: 420px;
  width: min(100%, 420px);
}

.tictactoe-board form {
  margin: 0;
  min-width: 0;
}

.tictactoe-cell {
  align-items: center;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.84);
  border: 2px solid rgba(6, 44, 67, 0.2);
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(6, 44, 67, 0.1);
  color: var(--navy);
  display: flex;
  font-size: 3rem;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 100%;
}

.tictactoe-cell:hover:not(:disabled) {
  border-color: var(--gold);
}

.tictactoe-cell:disabled {
  cursor: default;
  opacity: 1;
}

.tictactoe-cell.is-marked,
.tictactoe-cell.is-pending-move {
  background: rgba(248, 231, 166, 0.55);
}

.tictactoe-footer {
  margin: 0;
}

.connectfour-page {
  display: grid;
  gap: 1rem;
}

.connectfour-header {
  align-items: start;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.connectfour-header h1 {
  margin-bottom: 0.35rem;
}

.connectfour-header .lead {
  margin: 0;
}

.connectfour-lead {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.connectfour-status,
.connectfour-last-score {
  background: rgba(185, 237, 240, 0.62);
  border: 1px solid rgba(11, 97, 112, 0.18);
  border-radius: 8px;
  color: var(--navy);
  font-weight: 700;
  margin: 0;
  padding: 0.75rem;
}

.connectfour-timer {
  color: var(--muted);
  white-space: nowrap;
}

.connectfour-timer strong {
  color: var(--navy);
}

.connectfour-play-area {
  align-items: start;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr) 176px;
  max-width: 772px;
}

.connectfour-board {
  box-sizing: border-box;
  max-width: 560px;
  width: 100%;
}

.connectfour-board {
  aspect-ratio: 7 / 6;
  background: linear-gradient(160deg, var(--navy), var(--deep-teal));
  border: 4px solid rgba(6, 44, 67, 0.32);
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(255, 250, 240, 0.2), 0 12px 26px rgba(6, 44, 67, 0.2);
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  padding: 0.65rem;
}

.connectfour-cell-form {
  aspect-ratio: 1;
  margin: 0;
  min-width: 0;
}

.connectfour-cell {
  aspect-ratio: 1;
  background: rgba(255, 250, 240, 0.88);
  border: 2px solid rgba(6, 44, 67, 0.28);
  border-radius: 50%;
  box-shadow: inset 0 5px 12px rgba(6, 44, 67, 0.22);
  display: block;
  min-width: 0;
  padding: 0;
  width: 100%;
}

button.connectfour-cell {
  box-shadow: inset 0 5px 12px rgba(6, 44, 67, 0.22);
}

.connectfour-cell.is-player,
.connectfour-cell.is-pending-move {
  background: radial-gradient(circle at 35% 28%, #fecaca, #dc2626 68%);
}

.connectfour-cell.is-computer {
  background: radial-gradient(circle at 35% 28%, #bfdbfe, #2563eb 68%);
}

.connectfour-cell.is-playable {
  cursor: pointer;
}

.connectfour-cell.is-playable:hover {
  background: radial-gradient(circle at 35% 28%, #fee2e2, rgba(255, 250, 240, 0.9) 64%);
  border-color: #dc2626;
}

.connectfour-game-over {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.connectfour-footer {
  margin: 0;
}

.connectfour-score-panel {
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(11, 97, 112, 0.14);
  border-radius: 8px;
  box-sizing: border-box;
  padding: 0.9rem;
}

.connectfour-score-panel h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.connectfour-score-list {
  display: grid;
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.connectfour-score-list li {
  align-items: baseline;
  color: var(--muted);
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  line-height: 1.35;
}

.connectfour-score-list strong {
  color: var(--navy);
  margin: 0;
}

.connectfour-empty-score {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 700px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    padding: 0.8rem 1rem;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .app-layout {
    grid-template-columns: 1fr;
    margin: 2.25rem 1rem;
  }

  .app-layout main {
    order: 1;
  }

  .presence-sidebar {
    margin-left: 0;
    order: 2;
    position: static;
  }

  .right-rail {
    order: 3;
    position: static;
  }

  .hero-badge {
    width: 112px;
    height: 112px;
  }

  .tictactoe-header {
    flex-direction: column;
  }

  .connectfour-header {
    flex-direction: column;
  }

  .connectfour-play-area {
    grid-template-columns: 1fr;
  }

  .connectfour-score-panel {
    max-width: 620px;
  }
}

@media (max-width: 520px) {
  .pfztasks-page .task-actions button,
  .pfztasks-page .task-actions .button {
    flex: 1 1 auto;
    min-width: 0;
  }
}
