@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  background: #0b0f19;
  color: #f1f5f9;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overflow-x: hidden;
}

a {
  color: #38bdf8;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Top Navbar */
.top {
  position: fixed;
  width: 100vw;
  height: 56px;
  top: 0;
  left: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  z-index: 999;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.top-item {
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.top-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Desktop Side & Main */
#side {
  position: fixed;
  width: 220px;
  top: 56px;
  left: 0;
  height: calc(100vh - 56px);
  background: #0f172a;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 8px;
  overflow-y: auto;
}

.sideitem {
  width: 100%;
  height: 38px;
  line-height: 38px;
  border-radius: 8px;
  margin-bottom: 4px;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 0 14px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sideitem:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  transform: translateX(3px);
}

#main {
  position: fixed;
  width: calc(100vw - 220px);
  top: 56px;
  right: 0;
  height: calc(100vh - 56px);
  padding: 24px 32px;
  overflow-y: auto;
  background: #0b0f19;
}

/* Rom folder cards */
.cardcontainer {
  display: flex;
  flex-flow: row wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  width: 180px;
  text-align: center;
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  border-color: rgba(56, 189, 248, 0.3);
}

.card h2 {
  margin: 0 0 8px 0;
  font-size: 20px;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
}

.card p {
  margin: 2px 0;
  font-size: 13px;
  color: #94a3b8;
}

.scanbutton, .button {
  min-width: 100px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #ffffff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
  transition: all 0.2s;
}

.scanbutton:hover, .button:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
  transform: translateY(-1px);
}

/* Documentation / Readme Section */
.readme {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 24px;
  color: #cbd5e1;
  line-height: 1.6;
  max-width: 900px;
}

.readme h2 {
  color: #f8fafc;
  font-size: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
  margin-top: 24px;
}

.readme h3 {
  color: #38bdf8;
  font-size: 16px;
}

.readme ul, .readme ol {
  padding-left: 20px;
}

.readme li {
  margin-bottom: 6px;
}

.wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}

.itemwrapper {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.identifybutton {
  background: #334155;
  color: #e2e8f0;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
}

/* Modal */
#modal {
  display: none;
  position: fixed;
  width: 80vw;
  max-width: 800px;
  height: 80vh;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  z-index: 9999;
  padding: 24px;
  overflow: hidden;
}

#close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  background: #334155;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
}
#close::before {
  content: '✕';
  font-size: 16px;
}

#editor {
  width: 100%;
  height: 100%;
  border-radius: 10px;
}

.browser {
  position: fixed;
  width: calc(100vw - 220px);
  top: 56px;
  right: 0;
  height: calc(100vh - 56px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .top {
    position: fixed;
    height: 50px;
    top: 0;
    left: 0;
    padding: 4px 10px;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .top-item {
    font-size: 12px;
    padding: 6px 12px;
    flex-shrink: 0;
  }

  #side {
    position: fixed;
    width: 100vw;
    top: 50px;
    left: 0;
    height: 48px;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 10px;
    gap: 8px;
    background: #0f172a;
    z-index: 998;
  }

  .sideitem {
    width: auto;
    height: 34px;
    line-height: 34px;
    padding: 0 14px;
    border-radius: 17px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    font-size: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #main {
    position: relative;
    width: 100vw;
    top: 0;
    left: 0;
    margin-top: 98px;
    height: auto;
    min-height: calc(100vh - 98px);
    padding: 16px 12px;
    overflow-y: auto;
  }

  .wrapper {
    grid-template-columns: 1fr;
  }

  .card {
    width: 100%;
    max-width: none;
  }

  #modal {
    width: 95vw;
    height: 90vh;
    padding: 16px;
  }

  .browser {
    width: 100vw;
    position: relative;
    top: 0;
    margin-top: 98px;
    height: calc(100vh - 98px);
  }
}

.centered {
  text-align: center;
  padding: 40px 20px;
}

.hidden {
  display: none !important;
}
/* Hide ugly scrollbars on mobile */
::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}
* {
  scrollbar-width: none !important;
}

/* Side action bar buttons & step labels */
#side p {
  margin: 0 6px 0 10px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  color: #38bdf8 !important;
  display: inline-flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

#side button.button {
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  height: 32px !important;
  line-height: 32px !important;
  padding: 0 14px !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  border-radius: 16px !important;
  margin: 0 4px !important;
  background: linear-gradient(135deg, #4f46e5, #9333ea) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4) !important;
}