/* === Reset & Base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f8f9fa;
  color: #202124;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === Layout === */
.container {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

/* === Logo === */
.logo {
  margin-top: 60px;
  margin-bottom: 32px;
  text-align: center;
}

.logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a73e8;
  letter-spacing: -0.5px;
}

.logo p {
  font-size: 14px;
  color: #5f6368;
  margin-top: 6px;
}

.admin-topbar {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.btn-logo-change,
.btn-logo-reset {
  height: 30px;
  padding: 0 14px;
  border: 1px solid #dadce0;
  border-radius: 15px;
  background: #fff;
  color: #5f6368;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-logo-change:hover,
.btn-logo-reset:hover {
  background: #f1f3f4;
}

.btn-logo-change:disabled,
.btn-logo-reset:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Google-style search input === */
.search-box {
  width: 100%;
  position: relative;
  margin-bottom: 20px;
}

.search-box input {
  width: 100%;
  height: 50px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 0 48px 0 20px;
  font-size: 16px;
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s;
  background: #fff;
}

.search-box input:focus {
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.search-box .icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  font-size: 20px;
  pointer-events: none;
}

/* === OTP-style password inputs === */
.otp-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 24px;
}

.otp-group input {
  width: 60px;
  height: 72px;
  text-align: center;
  font-size: 32px;
  font-weight: 700;
  border: 2px solid #dfe1e5;
  border-radius: 12px;
  outline: none;
  text-transform: uppercase;
  caret-color: #1a73e8;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

.otp-group input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.otp-group input.error {
  border-color: #d93025;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.15);
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 24px;
  border: none;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #1a73e8;
  color: #fff;
}

.btn-primary:hover {
  background: #1557b0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-primary:disabled {
  background: #a8c7fa;
  cursor: not-allowed;
}

.btn-secondary {
  background: #fff;
  color: #1a73e8;
  border: 1px solid #dadce0;
}

.btn-secondary:hover {
  background: #f8f9fa;
}

.btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

/* === Cards === */
.card {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 16px;
}

/* === Step sections === */
.step {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
}

.step.active {
  display: flex;
}

/* === Step indicator === */
.step-indicator {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #dadce0;
  transition: background 0.3s;
}

.step-dot.active {
  background: #1a73e8;
}

/* === Messages === */
.message {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  text-align: center;
}

.message.error {
  background: #fce8e6;
  color: #d93025;
}

.message.success {
  background: #e6f4ea;
  color: #137333;
}

/* === Section title === */
.section-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
  color: #202124;
}

.section-sub {
  font-size: 14px;
  color: #5f6368;
  text-align: center;
  margin-bottom: 20px;
}

/* === QR Code area === */
.qr-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 16px 0;
}

.qr-area canvas,
.qr-area img {
  border-radius: 12px;
}

/* === Share link === */
.share-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f1f3f4;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.share-link input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 14px;
  color: #202124;
  outline: none;
}

.share-link button {
  background: none;
  border: none;
  color: #1a73e8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* === Video player === */
.video-container {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  margin-bottom: 16px;
}

.video-container iframe,
.video-container video {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  border: none;
}

/* === Toast === */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #323232;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Loading spinner === */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #dadce0;
  border-top: 3px solid #1a73e8;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 16px auto;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Admin login button (top-left) === */
.login-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid #dadce0;
  background: #fff;
  color: #5f6368;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background 0.2s, box-shadow 0.2s;
}

.login-btn:hover {
  background: #f1f3f4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* === Admin badge (top-left, replaces login btn when logged in) === */
.admin-badge {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #d2e3fc;
  border-radius: 20px;
  padding: 6px 14px 6px 12px;
  font-size: 13px;
  font-weight: 600;
  z-index: 100;
}

.admin-badge .badge-icon {
  font-size: 14px;
}

.admin-badge .logout-btn {
  background: none;
  border: none;
  color: #5f6368;
  cursor: pointer;
  font-size: 16px;
  padding: 0 0 0 4px;
  line-height: 1;
}

.admin-badge .logout-btn:hover {
  color: #d93025;
}

/* === Login modal === */
.login-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.login-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.login-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 90%;
  max-width: 340px;
  text-align: center;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.login-modal-overlay.active .login-modal {
  transform: scale(1);
}

.login-modal h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #202124;
}

.login-modal p {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 20px;
}

.login-modal input[type="password"] {
  width: 100%;
  height: 48px;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-modal input[type="password"]:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.login-modal .modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.login-modal .modal-btns .btn {
  flex: 1;
}

.login-modal .login-error {
  color: #d93025;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* === Student mode (on index page) === */
.student-mode-section {
  width: 100%;
  display: none;
  flex-direction: column;
  align-items: center;
}

.student-mode-section.active {
  display: flex;
}

.student-logo {
  width: 156px;
  height: auto;
  margin-bottom: 16px;
}

.code-input-box {
  width: 100%;
  position: relative;
  margin-bottom: 20px;
}

.code-input-box input {
  width: 100%;
  height: 50px;
  border: 1px solid #dfe1e5;
  border-radius: 24px;
  padding: 0 48px 0 20px;
  font-size: 16px;
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s;
  background: #fff;
  text-transform: lowercase;
}

.code-input-box input:focus {
  border-color: transparent;
  box-shadow: 0 1px 6px rgba(32, 33, 36, 0.28);
}

.code-input-box .icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa0a6;
  font-size: 20px;
  pointer-events: none;
}

/* === Tab group === */
.tab-group {
  display: flex;
  gap: 0;
  width: 100%;
  margin-bottom: 24px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #dadce0;
  background: #fff;
}

.tab-btn {
  flex: 1;
  height: 42px;
  border: none;
  background: #fff;
  color: #5f6368;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.tab-btn.active {
  background: #1a73e8;
  color: #fff;
}

.tab-btn:not(.active):hover {
  background: #f1f3f4;
}

/* === Search filter box === */
.search-filter-box {
  margin-bottom: 10px;
}

.search-filter-box input {
  height: 40px;
  font-size: 14px;
}

/* === Title input === */
.title-input-box {
  margin-top: -8px;
}

/* === Links table === */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 16px;
}

.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.links-table thead {
  background: #f1f3f4;
  position: sticky;
  top: 0;
}

.links-table th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: #5f6368;
  white-space: nowrap;
  border-bottom: 1px solid #dadce0;
}

.links-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f1f3f4;
  color: #202124;
  white-space: nowrap;
}

.links-table tbody tr:hover {
  background: #f8f9fa;
}

.links-table .url-cell {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a73e8;
  font-size: 12px;
}

.links-table .title-cell {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: #3c4043;
}

.links-table .pw-cell {
  font-weight: 700;
  font-family: monospace;
  font-size: 15px;
  letter-spacing: 2px;
  color: #1a73e8;
}

/* === Links table: mobile card layout === */
@media (max-width: 600px) {
  .table-scroll {
    overflow-x: visible;
  }

  .links-table {
    border: none;
  }

  .links-table thead {
    display: none;
  }

  .links-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 12px;
    gap: 6px 12px;
    overflow: hidden;
    max-width: 100%;
  }

  .links-table tbody tr:hover {
    background: #f8f9fa;
  }

  .links-table td {
    padding: 0;
    border-bottom: none;
    white-space: normal;
  }

  /* 번호: 왼쪽 */
  .links-table td.num-cell {
    font-size: 15px;
    color: #5f6368;
    font-weight: 600;
    min-width: 28px;
  }

  /* 비밀번호: 크게 강조 */
  .links-table td.pw-cell {
    font-size: 26px;
    letter-spacing: 5px;
    color: #1a73e8;
    font-weight: 700;
  }

  /* 조회수: 오른쪽 정렬 */
  .links-table td.view-cell {
    margin-left: auto;
    font-size: 14px;
    color: #5f6368;
  }

  .links-table td.view-cell::before {
    content: '조회 ';
  }

  /* 제목: 카드 맨 위 */
  .links-table td.title-cell {
    width: 100%;
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
    color: #202124;
    font-weight: 600;
    order: -1;
    margin-bottom: 4px;
  }

  .links-table td.title-cell.empty {
    color: #9aa0a6;
    font-weight: 400;
    font-size: 14px;
  }

  /* URL: 아래 줄 전체 너비 */
  .links-table td.url-cell {
    width: 100%;
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: #9aa0a6;
    margin-top: 4px;
    order: 6;
  }

  /* 코드 열: 모바일에서 숨김 */
  .links-table td.code-cell {
    display: none;
  }

  /* 체크박스: 왼쪽 상단 */
  .links-table td.chk-cell {
    order: -2;
    min-width: 28px;
  }

  /* 등록일: URL 아래 */
  .links-table td.date-cell {
    width: 100%;
    order: 7;
    font-size: 12px;
    color: #9aa0a6;
    margin-top: 2px;
  }

  .links-table td.date-cell::before {
    content: '등록 ';
  }

  .select-bar-hint span:last-child {
    font-size: 11px;
  }
}

/* === Edit modal === */
.edit-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.edit-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.edit-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  width: 90%;
  max-width: 340px;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.edit-modal-overlay.active .edit-modal {
  transform: scale(1);
}

.edit-modal h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #202124;
  text-align: center;
}

.edit-modal .edit-error {
  color: #d93025;
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
  text-align: center;
}

.edit-modal .edit-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  margin-bottom: 6px;
}

.edit-modal input[type="text"] {
  width: 100%;
  height: 48px;
  border: 1px solid #dfe1e5;
  border-radius: 8px;
  padding: 0 16px;
  font-size: 16px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.edit-modal input[type="text"]:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

.edit-info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f1f3f4;
}

.edit-info-row:last-of-type {
  margin-bottom: 20px;
}

.edit-info-label {
  font-size: 13px;
  font-weight: 600;
  color: #5f6368;
  white-space: nowrap;
  min-width: 60px;
}

.edit-info-value {
  font-size: 14px;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.edit-info-value.edit-info-url {
  font-size: 12px;
  color: #1a73e8;
  white-space: normal;
  word-break: break-all;
  overflow: visible;
  text-overflow: unset;
}

.edit-modal .modal-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.edit-modal .modal-btns .btn {
  flex: 1;
}

/* === List header (title + count) === */
.list-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.list-header .section-title {
  margin-bottom: 0;
}

.list-count {
  font-size: 13px;
  color: #9aa0a6;
  font-weight: 400;
  flex: 1;
}

/* === Export button (링크 목록 헤더) === */
.btn-export {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 17px;
  background: #137333;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-export:hover {
  background: #0d5c2a;
}

/* === Import tab (엑셀 입력) === */
.import-guide {
  text-align: left;
  margin-bottom: 20px;
}

.import-guide-title {
  font-size: 15px;
  font-weight: 700;
  color: #202124;
  margin-bottom: 6px;
}

.import-guide-desc {
  font-size: 13px;
  color: #5f6368;
  margin-bottom: 14px;
}

.format-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 14px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
}

.format-table th {
  background: #e8f0fe;
  color: #1a73e8;
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid #d2e3fc;
}

.format-table td {
  padding: 8px 12px;
  color: #202124;
  border-bottom: 1px solid #f1f3f4;
}

.format-table tbody tr:last-child td {
  border-bottom: none;
}

.format-table td:last-child {
  color: #1a73e8;
  font-size: 12px;
}

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

.format-notes li {
  font-size: 12px;
  color: #5f6368;
  padding: 3px 0 3px 16px;
  position: relative;
}

.format-notes li::before {
  content: '\2022';
  position: absolute;
  left: 4px;
  color: #9aa0a6;
}

/* === Import header === */
.import-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 14px;
}

.import-header .section-title {
  margin-bottom: 0;
  flex: 1;
  text-align: left;
}

.btn-import-file {
  height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 17px;
  background: #137333;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.btn-import-file:hover {
  background: #0d5c2a;
}

.btn-import-file:disabled {
  background: #93c9a1;
  cursor: not-allowed;
}

/* === Import progress bar === */
.import-progress {
  width: 100%;
  margin-bottom: 12px;
}

.import-progress-info {
  font-size: 13px;
  font-weight: 600;
  color: #202124;
  margin-bottom: 6px;
  text-align: center;
}

.import-progress-bar {
  width: 100%;
  height: 8px;
  background: #e8eaed;
  border-radius: 4px;
  overflow: hidden;
}

.import-progress-fill {
  height: 100%;
  width: 0%;
  background: #137333;
  border-radius: 4px;
  transition: width 0.3s;
}

/* === Filter tabs === */
.filter-tabs {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-bottom: 10px;
}

.filter-tab {
  flex: 1;
  height: 34px;
  border: 1px solid #dadce0;
  border-radius: 17px;
  background: #fff;
  color: #5f6368;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.filter-tab.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #d2e3fc;
}

.filter-tab:not(.active):hover {
  background: #f1f3f4;
}

/* === Select bar === */
.select-bar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #f1f3f4;
  border: 1px solid #e8eaed;
  border-radius: 10px;
  margin-bottom: 10px;
}

.select-bar-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.select-bar-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dadce0;
  color: #5f6368;
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.select-bar-hint span:last-child {
  font-size: 12px;
  color: #5f6368;
}

.select-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.select-bar-count {
  font-size: 13px;
  font-weight: 600;
  color: #1a73e8;
  white-space: nowrap;
}

.btn-select-all {
  height: 30px;
  padding: 0 14px;
  border: 1px solid #dadce0;
  border-radius: 15px;
  background: #fff;
  color: #5f6368;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-select-all:hover {
  background: #e8eaed;
}

.btn-delete {
  height: 28px;
  padding: 0 12px;
  border: none;
  border-radius: 14px;
  background: #d93025;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.2s;
}

.btn-delete:hover {
  background: #b3261e;
}

/* === Pagination === */
.pagination {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.page-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  background: #fff;
  color: #202124;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.page-btn.active {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
}

.page-btn:not(.active):not(.disabled):hover {
  background: #f1f3f4;
}

.page-nav {
  font-size: 12px;
  color: #5f6368;
}

.page-btn.disabled {
  color: #dadce0;
  cursor: default;
  border-color: #f1f3f4;
}

/* === Checkbox cells === */
.chk-cell {
  width: 36px;
  text-align: center !important;
}

.chk-cell input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1a73e8;
}

/* === Date cell === */
.links-table .date-cell {
  font-size: 12px;
  color: #5f6368;
  white-space: nowrap;
}

/* === Break button === */
.break-btn {
  margin-top: 12px;
  padding: 12px 32px;
  border: 1px solid #dadce0;
  border-radius: 22px;
  background: #fff;
  color: #5f6368;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.break-btn:active {
  transform: scale(0.97);
}

.break-btn:hover {
  background: #f1f3f4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* === Game modal === */
.game-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.game-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.game-modal {
  background: #fff;
  border-radius: 16px;
  width: 94%;
  max-width: 380px;
  max-height: 95vh;
  overflow-y: auto;
  padding: 24px 20px;
  transform: scale(0.95);
  transition: transform 0.2s;
  color: #202124;
}

.game-modal-overlay.active .game-modal {
  transform: scale(1);
}

.game-modal-title {
  font-size: 22px;
  font-weight: 800;
  text-align: center;
  margin-bottom: 6px;
  color: #202124;
}

.game-modal-desc {
  text-align: center;
  font-size: 13px;
  color: #5f6368;
  margin-bottom: 18px;
}

/* Game card */
.game-card {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

/* Game input fields */
.game-field-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.game-field {
  flex: 1;
}

.game-input-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #5f6368;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.game-input {
  width: 100%;
  height: 44px;
  border: 1px solid #dfe1e5;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
  background: #fff;
  color: #202124;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.game-input::placeholder {
  color: #bdc1c6;
}

.game-input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

/* Game start / exit buttons */
.game-start-btn {
  width: 100%;
  height: 46px;
  font-size: 16px;
  border-radius: 10px;
}

.game-exit-btn {
  width: 100%;
  height: 38px;
  font-size: 13px;
  border-radius: 10px;
  margin-top: 4px;
}

/* Rankings */
.ranking-card {
  padding-bottom: 12px;
}

.ranking-title {
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 12px;
  color: #202124;
}

.ranking-list {
  max-height: 240px;
  overflow-y: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.ranking-table thead tr {
  border-bottom: 1px solid #dadce0;
}

.ranking-table th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 600;
  color: #5f6368;
  font-size: 12px;
}

.ranking-table th:last-child {
  text-align: right;
}

.ranking-table td {
  padding: 8px 8px;
  color: #202124;
  border-bottom: 1px solid #f1f3f4;
}

.ranking-table td:first-child {
  width: 48px;
  text-align: center;
  color: #5f6368;
  font-weight: 600;
  white-space: nowrap;
}

.rank-num {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.ranking-table td:last-child {
  text-align: right;
  font-weight: 700;
  font-family: monospace;
  color: #1a73e8;
}

.ranking-reset-notice {
  text-align: center;
  font-size: 11px;
  color: #9aa0a6;
  margin-bottom: 10px;
}

.ranking-empty,
.ranking-loading {
  text-align: center;
  color: #9aa0a6;
  font-size: 13px;
  padding: 16px 0;
}

/* Game status bar */
.game-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.status-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #e8f0fe;
  border-radius: 16px;
  padding: 4px 12px;
  font-size: 13px;
  color: #1a73e8;
}

.status-chip.status-score {
  background: #e6f4ea;
  color: #137333;
}

.status-chip.status-best {
  background: #fef7e0;
  color: #ea8600;
}

.status-chip .status-label {
  font-size: 11px;
  font-weight: 500;
}

.status-chip strong {
  font-size: 16px;
  font-weight: 800;
}

.game-timer {
  font-size: 20px;
  font-weight: 800;
  color: #202124;
  font-family: monospace;
  margin-left: auto;
}

.game-close-x {
  background: none;
  border: none;
  color: #9aa0a6;
  font-size: 20px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}

.game-close-x:hover {
  color: #d93025;
}

/* Timer bar */
.timer-bar-wrap {
  width: 100%;
  height: 6px;
  background: #e8eaed;
  border-radius: 3px;
  margin-bottom: 16px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  width: 100%;
  background: #1a73e8;
  border-radius: 3px;
  transition: width 1s linear, background 0.3s;
}

/* Math play card */
.math-play-card {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 14px;
  padding: 20px 18px 14px;
}

.math-problem {
  font-size: 38px;
  font-weight: 800;
  text-align: center;
  padding: 24px 0;
  color: #202124;
  letter-spacing: 3px;
}

.math-otp-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}

.math-otp-group input {
  width: 52px;
  height: 64px;
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  border: 2px solid #dadce0;
  border-radius: 12px;
  outline: none;
  background: #fff;
  color: #202124;
  transition: border-color 0.2s, box-shadow 0.2s;
  caret-color: #1a73e8;
}

.math-otp-group input:focus {
  border-color: #1a73e8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.math-otp-group input.error {
  border-color: #d93025;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.15);
}

.math-feedback {
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  min-height: 22px;
  padding-top: 4px;
}

.math-feedback.correct {
  color: #137333;
}

.math-feedback.wrong {
  color: #d93025;
}

/* Result card */
.result-card {
  text-align: center;
  padding: 20px;
}

.result-label {
  font-size: 14px;
  color: #5f6368;
  margin-bottom: 4px;
}

/* Game over */
.final-score {
  font-size: 52px;
  font-weight: 800;
  color: #1a73e8;
  font-family: monospace;
}

.final-score-unit {
  font-size: 20px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #5f6368;
  margin-left: 4px;
}

.game-over-btns {
  display: flex;
  gap: 10px;
}

.game-over-btns .btn {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  font-size: 15px;
}

/* === Responsive === */
@media (max-width: 480px) {
  .game-modal {
    width: 96%;
    padding: 20px 16px;
    border-radius: 14px;
  }

  .game-modal-title {
    font-size: 20px;
  }

  .game-card {
    padding: 14px;
    border-radius: 12px;
  }

  .game-status-bar {
    gap: 6px;
  }

  .status-chip {
    padding: 3px 8px;
    font-size: 12px;
  }

  .status-chip strong {
    font-size: 14px;
  }

  .game-timer {
    font-size: 18px;
  }

  .math-play-card {
    padding: 14px 12px 10px;
  }

  .math-problem {
    font-size: 30px;
    padding: 18px 0;
    letter-spacing: 2px;
  }

  .math-otp-group input {
    width: 46px;
    height: 56px;
    font-size: 24px;
  }

  .final-score {
    font-size: 44px;
  }

  .game-over-btns .btn {
    height: 42px;
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .otp-group input {
    width: 52px;
    height: 64px;
    font-size: 28px;
  }

  .game-field-row {
    flex-direction: column;
    gap: 0;
  }

  .game-field .game-input {
    margin-bottom: 10px;
  }

  .math-problem {
    font-size: 26px;
    padding: 14px 0;
  }

  .status-chip {
    padding: 2px 6px;
    font-size: 11px;
  }

  .status-chip strong {
    font-size: 13px;
  }

  .game-timer {
    font-size: 16px;
  }
}
