:root {
  --bg: #080d14;
  --canvas: #091120;
  --panel: #202020;
  --ribbon: #292929;
  --line: #535353;
  --soft-line: #3e3e3e;
  --text: #f4f4f4;
  --muted: #c9c9c9;
  --blue: #6ea7ff;
  --share: #4f96ff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

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

button,
input,
select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

button {
  cursor: default;
}

.app {
  display: grid;
  grid-template-rows: 62px 36px 124px minmax(0, 1fr) 24px;
  width: 100vw;
  height: 100vh;
  background: var(--bg);
}

.titlebar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, 460px) minmax(150px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 0 clamp(8px, 1vw, 16px) 0 clamp(10px, 1.1vw, 20px);
  background: #080d14;
}

.doc-title,
.window-actions,
.tabs,
.tab-row,
.ribbon,
.control-row,
.statusbar,
.status-left,
.status-right {
  display: flex;
  align-items: center;
}

.doc-title {
  gap: 10px;
  font-size: 16px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.word-logo {
  display: grid;
  width: 19px;
  height: 18px;
  place-items: center;
  border-radius: 2px;
  background: linear-gradient(135deg, #27c3ff 0%, #236fff 48%, #0c39b6 100%);
  color: white;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -1px;
}

.top-search {
  display: flex;
  align-items: center;
  gap: 15px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid #666;
  border-radius: 4px;
  background: #202020;
}

.top-search input,
.nav-search input {
  width: 100%;
  outline: none;
}

.top-search input::placeholder,
.nav-search input::placeholder {
  color: #b9b9b9;
  opacity: 1;
}

.search-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  border: 2px solid #cfcfcf;
  border-radius: 50%;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  height: 2px;
  background: #cfcfcf;
  transform: rotate(-45deg);
  transform-origin: left center;
}

.search-icon.small {
  width: 14px;
  height: 14px;
  margin-right: 6px;
}

.window-actions {
  justify-content: flex-end;
  gap: clamp(10px, 1.4vw, 27px);
  min-width: 0;
}

.window-actions button {
  min-width: 28px;
  height: 30px;
  font-size: 23px;
  line-height: 1;
}

.window-actions .avatar {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  background: #667784;
  font-size: 12px;
}

.tabs {
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(8px, 0.8vw, 15px);
  background: #080d14;
}

.tab-row {
  gap: clamp(12px, 1.3vw, 25px);
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.tab-row button {
  height: 100%;
  font-size: 17px;
  white-space: nowrap;
}

.tab-row .active {
  border-bottom: 3px solid var(--blue);
  font-weight: 700;
}

.share {
  height: 31px;
  padding: 0 11px;
  border-radius: 4px;
  background: var(--share);
  color: #07101c;
  font-size: 17px;
}

.ribbon {
  align-items: stretch;
  overflow: hidden;
  padding-left: 10px;
  border-radius: 8px 8px 0 0;
  background: var(--ribbon);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.42);
}

.ribbon-group {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 124px;
  padding: 12px 10px 21px;
  border-right: 1px solid var(--line);
}

.group-label {
  position: absolute;
  right: 8px;
  bottom: 4px;
  left: 8px;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.clipboard {
  grid-template-columns: 57px 31px;
  width: 120px;
}

.paste {
  display: grid;
  justify-items: center;
  gap: 1px;
  font-size: 15px;
}

.paste-art {
  width: 25px;
  height: 33px;
  border: 2px solid #ddd;
  border-left: 4px solid #f0a72b;
  box-shadow: -7px -3px 0 -2px #f0a72b;
}

.clip-tools {
  display: grid;
  gap: 8px;
}

.clip-tools button {
  color: #d0d0d0;
  font-size: 22px;
}

.font {
  width: clamp(310px, 20vw, 386px);
  gap: 8px;
}

.paragraph {
  width: clamp(250px, 16vw, 308px);
  gap: 8px;
}

.control-row {
  gap: 8px;
}

.control-row select {
  height: 30px;
  border: 1px solid #777;
  border-radius: 3px;
  background: #1f1f1f;
  color: #fff;
  padding: 0 6px;
}

.control-row select:first-child {
  width: 122px;
}

.control-row .size {
  width: 88px;
}

.control-row button {
  display: grid;
  min-width: 22px;
  height: 25px;
  place-items: center;
  color: #d7d7d7;
  font-size: 18px;
}

.strong {
  font-weight: 800;
}

.italic {
  font-style: italic;
}

.under {
  text-decoration: underline;
}

.strike {
  text-decoration: line-through;
}

.text-blue,
.blue {
  color: #62b4ff !important;
}

.mark-yellow {
  border-bottom: 5px solid #fff200;
}

.mark-red {
  color: #fff !important;
  border-bottom: 5px solid #ff3030;
}

.box-on {
  width: 30px;
  border: 1px solid #999 !important;
  border-radius: 3px;
  background: #393939;
}

.styles {
  grid-template-columns: minmax(110px, 134px) minmax(108px, 126px) minmax(108px, 126px) minmax(108px, 126px) 31px;
  gap: 9px;
  width: clamp(470px, 31vw, 590px);
  padding-top: 16px;
}

.style-card {
  display: grid;
  height: 62px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #fff;
  background: white;
  color: #151515;
  font-size: 20px;
  white-space: nowrap;
}

.style-card.selected {
  outline: 3px solid #aaa;
  outline-offset: 2px;
}

.style-card.heading {
  color: #174b68;
  font-size: 28px;
}

.style-more {
  display: grid;
  height: 74px;
  place-items: center;
  border: 1px solid #777;
}

.editing {
  width: 168px;
  gap: 9px;
}

.editing button {
  display: flex;
  align-items: center;
  height: 24px;
  font-size: 16px;
  white-space: nowrap;
}

.replace {
  color: #eac9ff;
}

.pdf,
.addins {
  justify-items: center;
  width: 98px;
  gap: 7px;
  text-align: center;
  font-size: 16px;
}

.pdf-art {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #2f70d0;
  border-radius: 4px;
  color: #2f83ff;
  font-size: 28px;
}

.addins-art {
  width: 35px;
  height: 35px;
  border: 1px solid #ef4b16;
  background:
    linear-gradient(#ef4b16 0 0) 3px 3px / 12px 12px,
    linear-gradient(#ef4b16 0 0) 20px 3px / 12px 12px,
    linear-gradient(#ef4b16 0 0) 3px 20px / 12px 12px,
    linear-gradient(#ef4b16 0 0) 20px 20px / 12px 12px;
  background-repeat: no-repeat;
}

.workspace {
  display: grid;
  grid-template-columns: clamp(300px, 23vw, 438px) minmax(0, 1fr);
  min-height: 0;
  background: var(--canvas);
}

.navigation {
  padding: 18px 20px 0 15px;
  border-right: 1px solid #555;
  background: var(--panel);
}

.nav-title {
  display: grid;
  grid-template-columns: 1fr 46px 20px;
  align-items: center;
  margin-bottom: 22px;
}

.nav-title strong {
  font-size: 20px;
}

.nav-title button {
  font-size: 31px;
  line-height: 1;
}

.nav-search {
  display: grid;
  grid-template-columns: 1fr 22px 16px;
  align-items: center;
  height: 30px;
  margin-bottom: 25px;
  padding: 0 7px;
  border: 1px solid #5b5b5b;
  background: #333;
  color: #bebebe;
  font-size: 15px;
}

.nav-search span {
  color: white;
  font-size: 22px;
}

.nav-search button {
  color: white;
}

.nav-tabs {
  display: flex;
  gap: 30px;
  margin-bottom: 36px;
}

.nav-tabs button {
  padding: 0 0 12px;
  font-size: 16px;
}

.nav-tabs .active {
  border-bottom: 3px solid var(--blue);
  font-weight: 700;
}

.navigation p {
  max-width: 386px;
  width: 100%;
  margin: 0 0 20px;
  color: #fff;
  font-size: 16px;
  line-height: 1.25;
}

.document-canvas {
  position: relative;
  display: grid;
  place-items: start center;
  overflow: hidden;
  padding-top: 21px;
  background: #08101e;
}

.paper {
  width: clamp(420px, 58vw, 990px);
  height: 100%;
  background: #fff;
  box-shadow: 0 0 0 1px #d7d7d7;
}

.terminal-paper {
  overflow: auto;
  padding: clamp(28px, 4vw, 72px);
  color: #111;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(15px, 1.15vw, 20px);
  line-height: 1.45;
  outline: none;
}

.terminal-paper.dragging {
  box-shadow:
    inset 0 0 0 3px #4f96ff,
    0 0 0 1px #d7d7d7;
}

.terminal-lines {
  display: grid;
  align-content: start;
  gap: 4px;
}

.terminal-line {
  min-height: 1.45em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.terminal-line.problem,
.terminal-line.error {
  color: #b00020;
}

.terminal-line.ok,
.terminal-line.done {
  color: #106b38;
}

.terminal-line.running {
  color: #7a5a00;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  color: #111;
}

.terminal-prompt {
  flex: 0 0 auto;
}

.terminal-input-row input {
  flex: 1;
  min-width: 0;
  outline: none;
  caret-color: #111;
  color: #111;
  font-family: inherit;
  font-size: inherit;
}

.scrollbar {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 18px;
  background: #070b12;
}

.scrollbar::before,
.scrollbar::after {
  content: "";
  position: absolute;
  left: 3px;
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
}

.scrollbar::before {
  top: 4px;
  border-bottom: 8px solid #8b8b8b;
}

.scrollbar::after {
  bottom: 6px;
  border-top: 8px solid #8b8b8b;
}

.scrollbar span {
  position: absolute;
  top: 6px;
  left: 4px;
  width: 10px;
  height: 405px;
  border-radius: 8px;
  background: #9b9b9b;
}

.statusbar {
  justify-content: space-between;
  padding: 0 13px;
  background: #111;
  color: #fff;
  font-size: 13px;
}

.status-left {
  gap: clamp(10px, 1.4vw, 27px);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.status-right {
  gap: clamp(8px, 0.9vw, 18px);
  white-space: nowrap;
}

.status-active {
  display: grid;
  width: 31px;
  height: 24px;
  place-items: center;
  background: #2a2a2a;
}

.zoom {
  position: relative;
  display: inline-block;
  width: 140px;
  height: 2px;
  background: #aaa;
}

.zoom i {
  position: absolute;
  top: -7px;
  left: 77px;
  width: 6px;
  height: 16px;
  background: #aaa;
}

@media (max-width: 1550px) {
  .styles {
    width: 466px;
    grid-template-columns: 134px 126px 126px 31px;
  }

  .style-card:nth-of-type(4) {
    display: none;
  }
}

@media (max-width: 1320px) {
  .app {
    grid-template-rows: 54px 34px 112px minmax(0, 1fr) 24px;
  }

  .titlebar {
    grid-template-columns: minmax(160px, 1fr) minmax(220px, 360px) minmax(120px, 0.8fr);
  }

  .tab-row button {
    font-size: 15px;
  }

  .ribbon-group {
    min-height: 112px;
    padding: 9px 8px 19px;
  }

  .clipboard,
  .pdf,
  .addins {
    width: 86px;
  }

  .clip-tools,
  .clipboard .group-label,
  .pdf .group-label,
  .addins .group-label {
    display: none;
  }

  .font {
    width: 292px;
  }

  .paragraph {
    width: 224px;
  }

  .control-row {
    gap: 5px;
  }

  .control-row select:first-child {
    width: 108px;
  }

  .control-row .size {
    width: 58px;
  }

  .control-row button {
    min-width: 19px;
    font-size: 15px;
  }

  .styles {
    width: 365px;
    grid-template-columns: 115px 115px 115px 24px;
    gap: 6px;
  }

  .style-card {
    height: 55px;
    font-size: 17px;
  }

  .style-card.heading {
    font-size: 23px;
  }

  .style-card:nth-of-type(4) {
    display: none;
  }

  .editing {
    width: 132px;
  }

  .editing button {
    font-size: 14px;
  }

  .workspace {
    grid-template-columns: clamp(260px, 26vw, 350px) minmax(0, 1fr);
  }

  .paper {
    width: clamp(390px, 57vw, 850px);
  }
}

@media (max-width: 980px) {
  .app {
    grid-template-rows: 50px 34px 94px minmax(0, 1fr) 24px;
  }

  .titlebar {
    grid-template-columns: minmax(126px, 1fr) minmax(160px, 1.4fr) auto;
    gap: 8px;
  }

  .doc-title span:nth-child(n + 3) {
    display: none;
  }

  .top-search {
    height: 34px;
    padding: 0 10px;
  }

  .window-actions {
    gap: 4px;
  }

  .window-actions .avatar {
    display: none;
  }

  .tabs {
    overflow: hidden;
  }

  .tab-row {
    gap: 14px;
  }

  .tab-row button:nth-child(n + 7) {
    display: none;
  }

  .share {
    height: 28px;
    font-size: 14px;
  }

  .ribbon {
    padding-left: 6px;
  }

  .ribbon-group {
    min-height: 94px;
    padding: 7px 6px 17px;
  }

  .clipboard,
  .paragraph,
  .editing,
  .pdf,
  .addins {
    display: none;
  }

  .font {
    width: 282px;
  }

  .styles {
    width: calc(100vw - 300px);
    min-width: 260px;
    grid-template-columns: repeat(2, minmax(100px, 1fr)) 24px;
  }

  .style-card:nth-of-type(3) {
    display: none;
  }

  .style-card {
    height: 48px;
    font-size: 16px;
  }

  .workspace {
    grid-template-columns: clamp(220px, 31vw, 300px) minmax(0, 1fr);
  }

  .navigation {
    padding: 14px 12px 0;
  }

  .nav-title strong {
    font-size: 18px;
  }

  .nav-tabs {
    gap: 18px;
  }

  .navigation p {
    font-size: 14px;
  }

  .paper {
    width: calc(100vw - clamp(220px, 31vw, 300px) - 52px);
    min-width: 260px;
  }

  .status-left span:nth-child(n + 4),
  .status-right span:nth-child(-n + 4) {
    display: none;
  }
}

@media (max-width: 700px) {
  .app {
    grid-template-rows: 48px 34px 86px minmax(0, 1fr) 24px;
  }

  .titlebar {
    grid-template-columns: auto minmax(120px, 1fr) auto;
  }

  .tab-row button:nth-child(n + 5) {
    display: none;
  }

  .share {
    padding: 0 8px;
  }

  .font {
    width: 240px;
  }

  .control-row select:first-child {
    width: 98px;
  }

  .control-row button:nth-child(n + 7) {
    display: none;
  }

  .styles {
    width: calc(100vw - 252px);
    min-width: 180px;
    grid-template-columns: minmax(120px, 1fr) 24px;
  }

  .style-card:nth-of-type(n + 2) {
    display: none;
  }

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

  .navigation {
    display: none;
  }

  .paper {
    width: calc(100vw - 48px);
    min-width: 0;
  }

  .terminal-paper {
    padding: 16px;
    font-size: 14px;
  }

  .status-left span:nth-child(n + 3),
  .zoom,
  .status-right span:nth-last-child(n + 3) {
    display: none;
  }
}
