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

html, body {
  height: 100%;
  background: #1a1a1a;
  font-family: "Segoe UI", "Microsoft JhengHei", "Noto Sans TC", sans-serif;
  color: #fff;
}

body {
  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.window {
  width: 100%;
  min-height: 100%;
  background: #202020;
  display: flex;
  flex-direction: column;
  padding: 0 6px 8px;
}

.titlebar {
  display: flex;
  align-items: center;
  height: 32px;
  gap: 8px;
  padding-left: 6px;
  user-select: none;
}

.titlebar-icon {
  width: 16px;
  height: 16px;
  background: #3aa0ff;
  clip-path: polygon(20% 15%, 80% 15%, 80% 30%, 20% 30%, 20% 45%, 80% 45%, 80% 85%, 20% 85%);
}

.title {
  font-size: 12px;
  color: #fff;
  flex: 1;
}

.window-controls {
  display: flex;
  height: 32px;
}

.win-btn {
  width: 46px;
  height: 32px;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 14px;
  cursor: default;
}

.win-btn:hover {
  background: #333;
}

.win-btn.close:hover {
  background: #e81123;
}

.mode-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 4px;
  position: relative;
}

.mode-menu-wrap {
  position: relative;
}

.mode-menu {
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 10;
  min-width: 120px;
  background: #2b2b2b;
  border: 1px solid #444;
  border-radius: 4px;
  padding: 4px;
  display: flex;
  flex-direction: column;
}

.mode-menu[hidden] {
  display: none;
}

.mode-option {
  background: transparent;
  border: none;
  color: #fff;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 3px;
}

.mode-option:hover {
  background: #3a3a3a;
}

.mode-option.is-active {
  background: #3a5a7a;
}

.sci-keys {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding-bottom: 4px;
}

.sci-keys[hidden] {
  display: none;
}

.sci-keys button {
  background: #2a2a2a;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 14px;
  min-height: 40px;
  cursor: pointer;
}

.sci-keys button:hover {
  background: #3f3f3f;
}

.sci-keys button.is-active {
  background: #3a5a7a;
}

.icon-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 16px;
  width: 32px;
  height: 32px;
  cursor: default;
}

.mode {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 2px;
}

.spacer {
  flex: 1;
}

.display {
  margin: 8px 4px 10px;
  min-height: 88px;
  border: 1px solid #5a5a5a;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 8px 14px 10px;
  font-size: 56px;
  font-weight: 300;
  letter-spacing: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.memory-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 0 2px 6px;
}

.memory-row button {
  background: transparent;
  border: none;
  color: #ddd;
  height: 32px;
  font-size: 13px;
  cursor: pointer;
}

.memory-row button:hover:not(:disabled) {
  background: #3a3a3a;
}

.memory-row button:disabled {
  color: #777;
  cursor: default;
}

.keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  flex: 1;
}

.keys button {
  background: #323232;
  border: none;
  border-radius: 4px;
  color: #fff;
  font-size: 18px;
  min-height: 52px;
  cursor: pointer;
}

.keys button:hover {
  background: #3f3f3f;
}

.keys button:active {
  background: #2a2a2a;
}

.keys button em {
  font-style: italic;
  font-family: "Cambria Math", "Times New Roman", serif;
}

.equals {
  background: #7ec8e3 !important;
  color: #111 !important;
  font-size: 22px !important;
}

.equals:hover {
  background: #92d4eb !important;
}
