*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b3b1a;
  color: #f7f7f7;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #125827 0, #082712 60%, #041609 100%);
}

.top-bar {
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.brand {
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 0.95rem;
  text-transform: uppercase;
  color: #f9f9f9;
}

.brand-logo {
  height: 64px;
  width: auto;
  border-radius: 6px;
  object-fit: contain;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 8px 12px 12px;
  gap: 8px;
}

/* Academy info */

.academy-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.academy-card {
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.72rem;
}

.academy-card-title {
  font-weight: 600;
  margin-bottom: 2px;
}

.academy-card-text {
  opacity: 0.9;
}

.academy-card a {
  color: #f5c54b;
  text-decoration: none;
}

.academy-card a:hover {
  text-decoration: underline;
}

.bridgechamp-logo {
  display: block;
  margin-top: 4px;
  height: 64px;
  width: auto;
  border-radius: 6px;
}

/* Controls */

.controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.file-label {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: #f7f7f7;
  font-size: 0.78rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.file-label input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-label span {
  white-space: nowrap;
}

#viewBtn {
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #f5c54b;
  color: #2b1a00;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: 92px;
}

#viewBtn:disabled {
  opacity: 0.45;
  cursor: default;
}

.file-name {
  width: 100%;
  font-size: 0.72rem;
  color: #f7f7f7;
  opacity: 0.8;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  padding-left: 4px;
}

.file-name.no-file {
  opacity: 0.5;
}

.status {
  width: 100%;
  font-size: 0.72rem;
  min-height: 14px;
  padding-left: 4px;
  color: #f7f7f7;
}

.status.error {
  color: #ffaaaa;
}

/* Table layout */

.table-container {
  flex: 1;
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.8);
  background: radial-gradient(circle at center, #166a31 0, #0b3b1a 45%, #04190b 100%);
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.seat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat-label {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
}

.middle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 4px;
}

.seat-west,
.seat-east {
  flex: 1;
}

.board-info {
  min-width: 96px;
  max-width: 120px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.45);
  color: #f7f7f7;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.board-id {
  font-size: 0.78rem;
  font-weight: 600;
}

.board-meta {
  font-size: 0.7rem;
  opacity: 0.9;
}

.board-nav {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.board-counter {
  font-size: 0.7rem;
  opacity: 0.9;
}

.board-nav-btn {
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.35);
  color: #f7f7f7;
  font-size: 0.7rem;
  cursor: pointer;
}

.board-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.export-pdf-btn {
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #ffffff;
  color: #123016;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}

.export-pdf-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.duplicate-btn {
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #f5c54b;
  color: #2b1a00;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}

.export-pbn-btn {
  margin-top: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: none;
  background: #ffffff;
  color: #123016;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  width: 100%;
}

.export-pbn-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.duplicate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.duplicate-card {
  width: 90%;
  max-width: 360px;
  border-radius: 16px;
  background: #0b3b1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 14px 16px 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

.duplicate-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

.duplicate-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.duplicate-field label {
  font-size: 0.75rem;
  opacity: 0.9;
}

.duplicate-field input {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 10px;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.35);
  color: #f7f7f7;
  outline: none;
}

.duplicate-field input:focus {
  border-color: #f5c54b;
}

.duplicate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.duplicate-actions button {
  padding: 7px 12px;
  border-radius: 999px;
  border: none;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
}

.duplicate-cancel {
  background: rgba(0, 0, 0, 0.4);
  color: #f7f7f7;
}

.duplicate-create {
  background: #f5c54b;
  color: #2b1a00;
}

/* Hands */

.hand {
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  width: 100%;
  max-width: 220px;
  font-size: 0.72rem;
  line-height: 1.35;
}

.suit-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
}

.suit-symbol {
  width: 12px;
  text-align: center;
}

.suit-spades,
.suit-clubs {
  color: #f7f7f7;
}

.suit-hearts,
.suit-diamonds {
  color: #ffb4b4;
}

.cards {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive tweaks */

@media (min-height: 700px) {
  .hand {
    font-size: 0.78rem;
  }
}

.powered-by {
  margin-top: auto;
  padding: 6px 10px 10px;
  font-size: 0.7rem;
  text-align: center;
  opacity: 0.8;
  color: #f7f7f7;
}

.powered-by a {
  color: #f5c54b;
  text-decoration: none;
  font-weight: 600;
}

.powered-by a:hover {
  text-decoration: underline;
}