:root {
  color-scheme: dark;
  --bg: #050c18;
  --bar-bg: #07111ecc;
  --border: rgba(154, 171, 204, 0.16);
  --text: #eef4ff;
  --muted: #9aabc8;
  --accent: #69a8ff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  font-family: "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
a,
iframe {
  font: inherit;
}

.app-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 6px 10px;
  background: var(--bar-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 10;
}

.toolbar {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.icon-button,
.icon-link,
.tab-button {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  text-decoration: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.icon-button {
  cursor: pointer;
}

.icon-button:hover,
.icon-link:hover,
.tab-button:hover {
  transform: translateY(-1px) scale(1.01);
  border-color: rgba(106, 168, 255, 0.55);
  background: rgba(255, 255, 255, 0.08);
}

.tabbar {
  display: flex;
  flex: 1;
  min-width: 0;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabbar::-webkit-scrollbar {
  display: none;
}

.tab-button {
  padding: 6px 11px;
  min-height: 32px;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

.tab-button.active {
  background: linear-gradient(135deg, rgba(79, 142, 247, 0.94), rgba(88, 183, 255, 0.9));
  border-color: transparent;
  color: #031325;
  font-weight: 700;
}

.icon-button,
.icon-link {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.viewer {
  min-height: 0;
  overflow: hidden;
}

.panels {
  height: 100%;
  min-height: 0;
  position: relative;
}

.panel {
  display: none;
  height: 100%;
}

.panel.active {
  display: block;
}

.panel-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.widget-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(15, 26, 44, 0.85), rgba(8, 17, 31, 0.92)),
    #091320;
}

.widget-note {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.widget-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 0.78rem;
}

.widget-note a {
  color: #8dc2ff;
}

.widget-host {
  flex: 1;
  min-height: 0;
}

.widget-status {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.widget-status.error {
  color: #ffb4b4;
}

@media (max-width: 920px) {
  .app-shell {
    min-height: 100dvh;
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 44px;
    padding: 5px 8px;
  }

  .tab-button,
  .icon-button,
  .icon-link {
    min-height: 30px;
    height: 30px;
  }

  .tab-button {
    padding: 5px 9px;
    font-size: 0.78rem;
  }
}
