:root {
  --el-navy: #0b2341;
  --el-navy-dark: #07182d;
  --el-yellow: #f5c400;
  --el-yellow-hover: #ffd52e;
  --el-white: #ffffff;
  --el-gray: #edf1f5;
  --el-text: #18212b;
  --el-muted: #6b7280;
  --el-danger: #9b1c1c;

  --el-modal-width: 600px;
  --el-modal-height: 700px;
  --el-modal-mobile-width: 90vw;
  --el-modal-mobile-height: 70vh;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Arial, Helvetica, sans-serif;
}

body {
  background: var(--el-gray);
  color: var(--el-text);
}

.page {
  padding: 30px;
}

.page h1 {
  color: var(--el-navy);
}

.page-note {
  color: var(--el-muted);
}

/* Modal */
.el-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
}

.el-modal.is-open {
  display: flex;
}

.el-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.el-dialog {
  position: relative;
  z-index: 1;
  width: var(--el-modal-width);
  height: var(--el-modal-height);
  max-width: 96vw;
  max-height: 94vh;
  background: var(--el-white);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,.35);
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.el-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--el-navy);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.el-close:hover,
.el-close:focus-visible {
  background: var(--el-gray);
}

.el-header {
  text-align: center;
  padding: 8px 40px 12px;
}

.el-header h2 {
  margin: 0 0 8px;
  color: var(--el-navy);
  font-size: 28px;
  text-transform: uppercase;
}

.el-counter {
  font-size: 20px;
  font-weight: 700;
  color: var(--el-navy);
}

.el-card-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px;
}

.el-card-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 10px;
}

.el-status {
  min-height: 24px;
  text-align: center;
  font-size: 17px;
  color: var(--el-muted);
  font-weight: 600;
}

.el-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: 12px;
}

.el-btn {
  border: 0;
  border-radius: 9px;
  min-height: 48px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s ease, transform .05s ease, background .15s ease;
}

.el-btn:active:not(:disabled) {
  transform: translateY(1px);
}

.el-btn:focus-visible,
.el-close:focus-visible {
  outline: 3px solid var(--el-yellow);
  outline-offset: 2px;
}

.el-btn:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.el-btn-start {
  background: var(--el-yellow);
  color: var(--el-navy-dark);
  min-width: 130px;
}

.el-btn-start:hover:not(:disabled) {
  background: var(--el-yellow-hover);
}

.el-btn-next {
  background: var(--el-navy);
  color: var(--el-white);
  min-width: 150px;
  font-size: 18px;
}

.el-btn-next:hover:not(:disabled) {
  background: var(--el-navy-dark);
}

.el-btn-repeat {
  background: var(--el-gray);
  color: var(--el-navy);
  min-width: 115px;
}

.el-btn-repeat:hover:not(:disabled) {
  background: #dfe5eb;
}

.el-restart-wrap {
  text-align: center;
  padding-top: 10px;
}

.el-btn-restart {
  min-height: 36px;
  padding: 6px 14px;
  background: transparent;
  color: var(--el-muted);
  font-size: 13px;
  border: 1px solid #cfd6dd;
}

.el-btn-restart:hover:not(:disabled) {
  color: var(--el-danger);
  border-color: #c9a3a3;
  background: #fff8f8;
}

.el-complete {
  margin-top: 10px;
  padding: 10px;
  border-radius: 8px;
  background: #fff7cf;
  color: var(--el-navy);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.el-complete[hidden] {
  display: none;
}

/* Restart confirmation */
.el-confirm {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(7, 24, 45, .58);
}

.el-confirm[hidden] {
  display: none;
}

.el-confirm-box {
  width: min(420px, 100%);
  background: var(--el-white);
  border-radius: 14px;
  padding: 24px;
  text-align: center;
  box-shadow: 0 15px 45px rgba(0,0,0,.3);
}

.el-confirm-box h3 {
  margin: 0 0 10px;
  color: var(--el-navy);
}

.el-confirm-box p {
  margin: 0 0 20px;
  color: var(--el-text);
}

.el-confirm-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.el-btn-cancel {
  background: var(--el-gray);
  color: var(--el-navy);
}

.el-btn-confirm {
  background: var(--el-navy);
  color: var(--el-white);
}

body.el-no-scroll {
  overflow: hidden;
}

@media (max-width: 700px) {
  .el-dialog {
    width: var(--el-modal-mobile-width);
    height: var(--el-modal-mobile-height);
    padding: 15px;
    border-radius: 14px;
  }

  .el-header h2 {
    font-size: 22px;
  }

  .el-counter {
    font-size: 18px;
  }

  .el-controls {
    gap: 6px;
  }

  .el-btn {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 14px;
  }

  .el-btn-next {
    min-width: 110px;
  }

  .el-btn-start,
  .el-btn-repeat {
    min-width: 90px;
  }

  .el-close {
    width: 38px;
    height: 38px;
    font-size: 27px;
  }
}
