:root{
  --navy:#0f2a44;
  --navy2:#123457;
  --panel:#0b1f33;
  --text:#e8f0ff;
  --muted:#a9bfdc;
  --accent:#59d2ff;
  --border: rgba(255,255,255,0.12);
}

*{ box-sizing:border-box; }
html, body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--navy);
  color: var(--text);

  height: 100vh;
  overflow: hidden;
}

.topbar{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 18px;
  background: var(--navy2);
  border-bottom: 1px solid var(--border);
}
.brand{ font-weight:700; letter-spacing:0.2px; }
.nav{ display:flex; gap:18px; }
.navlink{
  color: var(--text);
  text-decoration:none;
  opacity:0.9;
}
.navlink:hover{ opacity:1; text-decoration:underline; }

.layout{
  display:grid;
  grid-template-columns: 280px 1fr;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.sidebar{
  padding:16px;
  border-right: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
}
.sidebar h2{
  margin:4px 0 14px;
  font-size: 14px;
  letter-spacing:1.4px;
  opacity:0.9;
}
.block{
  padding:12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.12);
  margin-bottom:12px;
}
.block h3{
  margin:0 0 8px;
  font-size: 14px;
}
.hint{
  font-size:12px;
  color: var(--muted);
  margin-top:6px;
}

.btn, .btn2{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  padding:10px 12px;
  cursor:pointer;
  user-select:none;
}
.btn:hover, .btn2:hover{ border-color: rgba(255,255,255,0.25); }
.btn2{
  padding:10px 10px;
  width: 100%;
}
.btn2:disabled{
  opacity:0.5;
  cursor:not-allowed;
}

.row{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-top:10px;
}

.check{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top:10px;
  font-size:13px;
  color: var(--muted);
}

.status{
  font-size:13px;
  color: var(--text);
  line-height:1.35;
}

.viewer{
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:12px;
  overflow: hidden;
  position: relative;
  height: 100%;
}

.canvasWrap{
  flex:1;
  min-height: 420px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.18);
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

canvas{
  display:block;
  max-width: 100%;
  max-height: 100%;
}

.footerHint{
  font-size:12px;
  color: var(--muted);
  opacity:0.95;
}

.viewer {
  position: relative;
}

.exportPopover {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(20, 24, 32, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.exportPopoverTitle {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: #fff;
}

.hidden {
  display: none;
}

.bottomDrawer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  pointer-events: none;
}

.bottomDrawerContent {
  pointer-events: auto;
  position: relative;
  width: 100%;
  height: calc(100vh - 56px);
  max-height: calc(100vh - 56px);
  min-height: 300px;
  background: rgba(20, 24, 32, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.24);
  overflow: hidden;
  transform: translateY(calc(100% - 56px));
  transition: transform 0.12s ease-out;
  touch-action: none;
}

.bottomDrawer.dragging .bottomDrawerContent {
  transition: none;
}

.bottomDrawerHandle {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px 12px;
  cursor: grab;
  user-select: none;
  background: rgba(20, 24, 32, 0.98);
}

.bottomDrawer.dragging .bottomDrawerHandle {
  cursor: grabbing;
}

.bottomDrawerGrip {
  width: 52px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.bottomDrawerTitle {
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
}

.bottomDrawerInner {
  display: flex;
  flex-direction: column;
  padding: 0 18px 18px;
  color: white;
  height: calc(100% - 64px);
  overflow: hidden;
}

.tableWrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-top: 12px;
}

.overviewTable {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.overviewTable th,
.overviewTable td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.overviewTable th {
  position: sticky;
  top: 0;
  background: rgba(20, 24, 32, 0.98);
  z-index: 1;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.modal.hidden {
  display: none;
}

.modalContent {
  position: relative;
  width: min(680px, 92vw);
  max-height: 82vh;
  overflow-y: auto;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modalContent h2 {
  margin-top: 0;
}

.modalContent h3 {
  margin-bottom: 6px;
}

.modalContent p {
  color: var(--muted);
  line-height: 1.5;
}

.modalClose {
  position: absolute;
  top: 12px;
  right: 14px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 28px;
  cursor: pointer;
}

.exportLabel {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 10px;
  margin-bottom: 4px;
}

.select2 {
  width: 100%;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 8px;
}