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

:root {
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-dark: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.15);
  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-hover: #f8fafc;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --font: 'Roboto Condensed', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --max-w: 640px;
}

[data-theme="dark"] {
  --accent: #60a5fa;
  --accent-light: #93c5fd;
  --accent-dark: #3b82f6;
  --accent-glow: rgba(96, 165, 250, 0.12);
  --bg: #0b1120;
  --surface: #1a2332;
  --surface-hover: #1e293b;
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #1e293b;
  --border-light: #1a2332;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding: 24px 16px 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ====== Container ====== */
.container {
  width: 100%;
  max-width: var(--max-w);
}

/* ====== Header ====== */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px 28px;
  margin-bottom: 28px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-glow), transparent 60%);
  pointer-events: none;
}

.logo {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.logo::after {
  content: 'MK7';
  font-family: var(--font);
  letter-spacing: 1px;
}

.title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.header_title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-align: center;
  line-height: 1.3;
}

.header_subtitle {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  text-align: center;
}

/* ====== Search ====== */
.search-wrap {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto 20px;
  position: relative;
}

.search-wrap::before {
  content: '\1F50D';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
  z-index: 1;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

/* ====== Progress Bar ====== */
.progress-bar {
  margin: 0 0 16px;
  height: 28px;
  background: var(--bg);
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}

.progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  z-index: 1;
  letter-spacing: 0.3px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 14px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ====== Cards (accordion) ====== */
.card {
  width: 100%;
  margin-bottom: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition), opacity 0.5s ease, transform 0.5s ease;
  opacity: 0;
  transform: translateY(20px);
  transition-delay: var(--delay, 0s);
}

.card[open] .record:first-of-type {
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card.card-visible {
  opacity: 1;
  transform: translateY(0);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card[open] {
  box-shadow: var(--shadow-md);
}

.card__title {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 56px 18px 20px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  position: relative;
  -webkit-user-select: none;
  user-select: none;
  list-style: none;
  transition: background var(--transition);
}

.card__title::-webkit-details-marker {
  display: none;
}

.card__title:hover {
  background: var(--surface-hover);
}

.card__title::before {
  content: '';
  width: 28px;
  height: 28px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  flex-shrink: 0;
}

.card__title::after {
  content: '';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--border);
  border-radius: 50%;
  transition: background var(--transition), transform 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card__title::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475669' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: 14px;
  background-repeat: no-repeat;
  background-position: center;
}

.card[open] > .card__title::after {
  transform: translateY(-50%) rotate(180deg);
  background-color: var(--accent-glow);
}

.android-icon::before {
  background-image: url(../images/android-original-logo.svg);
}

.ios-icon::before {
  background-image: url(../images/apple-logo.svg);
}

.error-icon::before {
  background-image: url(../images/error.svg);
}

.lifehaker-icon::before {
  background-image: url(../images/lamp.svg);
}

.parent-icon::before {
  background-image: url(../images/help.svg);
}

/* ====== Records ====== */
.record {
  position: relative;
  padding: 20px 16px 16px 44px;
  border-top: 1px solid var(--border);
  transition: background var(--transition), border-color var(--transition);
}

.record:hover {
  background: var(--surface-hover);
}

.record__id {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.record > p {
  font-size: 15px;
  margin-bottom: 6px;
  line-height: 1.6;
}

.record > p:last-child {
  margin-bottom: 0;
}

.record ol,
.record ul {
  margin: 8px 0 8px 20px;
}

.record li {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 4px;
}

/* ====== Checklist ====== */
.record-check {
  position: absolute;
  top: 20px;
  left: 12px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--accent);
  border-radius: 4px;
  z-index: 2;
}

.record-inner {
  display: flex;
  flex-direction: column;
}

.record:has(.record-check:checked) {
  opacity: 0.55;
}

.record:has(.record-check:checked) .record-inner {
  text-decoration: line-through;
  text-decoration-color: var(--text-muted);
}

/* ====== Text styles ====== */
.accentText {
  color: var(--accent);
  font-weight: 600;
}

.commentText {
  display: block;
  font-size: 13px;
  font-style: italic;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.5;
}

/* ====== Warning ====== */
.warning {
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.08), rgba(255, 152, 0, 0.04));
  border-left: 4px solid #ff9800;
  padding-left: 40px;
}

.warning .record__id {
  color: #e65100;
}

[data-theme="dark"] .warning {
  background: linear-gradient(135deg, rgba(255, 183, 77, 0.06), rgba(255, 152, 0, 0.03));
}

/* ====== Images ====== */
.list-img {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.list-img.image {
  max-width: 320px;
  width: 100%;
  cursor: pointer;
}

.list-img.image:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.list-img.icon {
  width: 48px;
  aspect-ratio: 1;
  margin: 12px auto;
}

/* ====== Thanks ====== */
.thanks {
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  line-height: 1.4;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  padding: 20px 0;
}

/* ====== Error nodata ====== */
.err__decor-nodata {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.06), rgba(239, 68, 68, 0.03));
  padding: 20px 24px;
  border-left: 4px solid #dc2626;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-size: 15px;
  line-height: 1.7;
}

.err__title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
  font-family: var(--font);
}

.err__list-decor {
  padding-left: 24px;
  margin: 12px 0;
}

.err__item-decor {
  list-style: disc;
  margin-bottom: 6px;
}

[data-theme="dark"] .err__decor-nodata {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.1), rgba(239, 68, 68, 0.05));
}

/* ====== Error 500 ====== */
.err.err500 {
  text-align: center;
  padding: 16px;
}

.err.err500 h3 {
  font-size: 48px;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 4px;
}

.err.err500 > p {
  text-align: center;
}

.imgErr500 {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}

.err__subtitle {
  color: var(--text-secondary);
}

.sub-list {
  margin: 8px 0 8px 20px;
}

.sub-list > li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 3px 0;
}

/* ====== Duplicate error sample ====== */
.errDublicate-sample {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  background: linear-gradient(145deg, #1e1b4b, #312e81);
  border-radius: var(--radius);
  padding: 28px 20px 60px;
  position: relative;
  box-shadow: var(--shadow-lg);
  color: #fff;
}

.errDublicate-sample__title {
  font-size: 22px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 24px;
  color: #e0e7ff;
}

.errDublicate-sample__card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.errDublicate-sample__container {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 8px;
}

.colorWarning {
  color: #fca5a5;
}

.errDublicate-sample__text.personal-position {
  text-align: center;
  font-size: 13px;
  margin-bottom: 16px;
}

.errDublicate-sample__button {
  width: 100%;
  padding: 14px;
  background: #fff;
  color: #1e1b4b;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.errDublicate-sample__button:hover {
  opacity: 0.9;
}

.errDublicate-sample__DeleteRecord {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 16px;
  transition: color var(--transition);
}

.errDublicate-sample__DeleteRecord:hover {
  color: #fff;
}

/* ====== QR Code ====== */
.qrcode {
  display: flex;
  justify-content: center;
  margin: 24px 0 16px;
}

.qrcode img {
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-sm);
}

/* ====== Lightbox ====== */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

.lightbox-overlay.open {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.lightbox-img {
  max-width: 95%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ====== Floating buttons ====== */
.scroll-top,
.theme-toggle,
.print-btn {
  position: fixed;
  right: 20px;
  z-index: 1000;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.scroll-top {
  bottom: 100px;
  width: 48px;
  height: 48px;
  background: var(--accent);
  color: #fff;
  font-size: 22px;
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
}

.scroll-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

.scroll-top.visible:hover {
  transform: translateY(-2px);
}

.theme-toggle {
  bottom: 44px;
  width: 48px;
  height: 48px;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  border: 2px solid var(--border);
}

.theme-toggle:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.print-btn {
  bottom: 156px;
  padding: 0 20px;
  height: 48px;
  border-radius: 24px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  white-space: nowrap;
}

.print-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}

/* ====== Record active highlight ====== */
.record-active {
  background: var(--accent-glow) !important;
  border-left: 4px solid var(--accent);
  padding-left: 40px;
}

.record-active .record__id {
  color: var(--accent);
}

/* ====== Responsive ====== */
@media (max-width: 640px) {
  body {
    padding: 16px 12px 140px;
  }

  .header {
    padding: 24px 16px 20px;
  }

  .header_title {
    font-size: 19px;
  }

  .logo {
    width: 60px;
    height: 60px;
    font-size: 26px;
    border-radius: 16px;
  }

  .card__title {
    font-size: 15px;
    padding: 16px 48px 16px 16px;
  }

  .card__title::before {
    width: 24px;
    height: 24px;
  }

  .record {
    padding: 16px 12px 12px 40px;
  }

  .scroll-top {
    bottom: 84px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .theme-toggle {
    bottom: 34px;
    right: 12px;
    width: 42px;
    height: 42px;
    font-size: 18px;
  }

  .print-btn {
    bottom: 132px;
    right: 12px;
    padding: 0 14px;
    height: 42px;
    font-size: 13px;
  }

  .lightbox-close {
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
}

/* ====== Print styles ====== */
@media print {
  .scroll-top,
  .theme-toggle,
  .print-btn,
  .search-wrap,
  .qrcode,
  .lightbox-overlay,
  .record-check,
  .progress-bar {
    display: none !important;
  }

  .record {
    opacity: 1 !important;
    padding-left: 16px;
    break-inside: avoid;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 8px;
  }

  .record-inner {
    text-decoration: none !important;
  }

  .card__title::after {
    display: none;
  }

  body {
    padding: 0;
    background: #fff;
    color: #000;
  }

  .card {
    border: 1px solid #ccc;
    margin-bottom: 12px;
    border-radius: 8px;
    box-shadow: none;
  }

  details.card:not([open]) {
    display: block !important;
  }

  details.card summary {
    display: block;
  }

  .record-active {
    background: none !important;
    border-left-color: #ccc !important;
    padding-left: 16px;
  }
}
