:root {
  --shared-shell-control-height:36px;
  --shared-shell-small-text:.8rem;
  --shared-shell-footer-text:.76rem;
  --shared-shell-footer-line:#e6ebf2;
}

html[lang="ko"] body {
  word-break:keep-all;
  overflow-wrap:normal;
}

html[lang="ko"] :is(code,pre,[data-wrap-anywhere]) {
  word-break:normal;
  overflow-wrap:anywhere;
}

body:has(:is(.game-footer,.site-footer)) {
  padding-top:0 !important;
  padding-bottom:0 !important;
}

:is(.app,.app-shell,.embed-shell,.shell,.landing-shell):has(> :is(.game-footer,.site-footer)) {
  min-height:100vh !important;
  min-height:100dvh !important;
  padding-top:0 !important;
  padding-bottom:0 !important;
}

.embed-shell:has(> .frame-wrap),
.embed-shell.is-search,
.embed-shell.is-frame {
  height:var(--embed-viewport-height,var(--march-exam-viewport-height,100vh)) !important;
  height:var(--embed-viewport-height,var(--march-exam-viewport-height,100dvh)) !important;
  min-height:0 !important;
}

.shell:has(> .site-footer) {
  display:flex !important;
  flex-direction:column !important;
}

.shell > .site-footer,
.landing-shell > .site-footer {
  margin-top:auto !important;
}

.utility-bar,
.utility {
  min-height:42px !important;
  padding-block:3px !important;
  gap:8px !important;
}

.archive-link,
.utility-link {
  font-size:.82rem !important;
  line-height:1.4 !important;
  white-space:nowrap;
}

.student-chip {
  font-size:.82rem !important;
}

.locale-select {
  box-sizing:border-box;
  height:var(--shared-shell-control-height) !important;
  min-height:var(--shared-shell-control-height) !important;
  padding:7px 30px 7px 10px !important;
  font-size:var(--shared-shell-small-text) !important;
  line-height:1.2 !important;
}

.utility-bar .utility-link,
.utility .utility-link {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:var(--shared-shell-control-height) !important;
}

.utility-bar :is(.fullscreen-button,.fullscreen-btn,.icon-button),
.utility :is(.fullscreen-button,.fullscreen-btn,.icon-button),
.topnav :is(.student-fullscreen-button,.fullscreen-button,.fullscreen-btn,.icon-button) {
  width:38px !important;
  min-width:38px !important;
  height:var(--shared-shell-control-height) !important;
  min-height:var(--shared-shell-control-height) !important;
  padding:0 !important;
  font-size:.8rem !important;
}

.topnav {
  min-height:42px !important;
  padding-block:3px !important;
  gap:8px !important;
}

.topnav .brand {
  gap:7px !important;
  font-size:1rem !important;
}

.topnav .brand::before {
  width:24px !important;
  height:24px !important;
  flex-basis:24px !important;
}

.topnav :is(.link-btn,.button) {
  min-height:var(--shared-shell-control-height) !important;
  padding:8px 12px !important;
  font-size:.82rem !important;
}

.game-footer,
.site-footer {
  align-items:center;
  margin-bottom:0 !important;
  border-top:1px solid var(--shared-shell-footer-line) !important;
  padding-top:10px !important;
  padding-bottom:calc(10px + env(safe-area-inset-bottom,0px)) !important;
  gap:8px 24px !important;
  font-size:var(--shared-shell-footer-text) !important;
  line-height:1.5 !important;
}

.game-footer p,
.site-footer p {
  margin:0;
}

.game-footer a,
.site-footer a {
  color:inherit;
  text-underline-offset:3px;
}

.footer-contact-button {
  display:inline;
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  cursor:pointer;
  text-decoration:underline;
  text-underline-offset:3px;
}

.footer-contact-button::before {
  display:inline-block;
  margin-right:5px;
  color:#98a2b3;
  content:"·";
  text-decoration:none;
}

.footer-contact-button:hover,
.footer-contact-button:focus-visible {
  color:#4338ca;
}

.contact-dialog {
  position:fixed;
  z-index:1000;
  inset:0;
  margin:auto;
  width:min(540px,calc(100vw - 28px));
  height:min(570px,calc(100dvh - 28px));
  max-width:none;
  max-height:none;
  padding:0;
  border:1px solid #d8deea;
  border-radius:16px;
  background:#fff;
  box-shadow:0 24px 64px rgba(15,23,42,.24);
  overflow:hidden;
}

.contact-dialog::backdrop {
  background:rgba(15,23,42,.42);
  backdrop-filter:blur(2px);
}

.contact-dialog-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  height:48px;
  padding:0 10px 0 18px;
  border-bottom:1px solid #e8ecf2;
  background:linear-gradient(90deg,#f7f5ff 0%,#fff 72%);
  color:#172033;
  font-size:.94rem;
  cursor:move;
  touch-action:none;
  user-select:none;
}

.contact-dialog[data-dragging="true"] .contact-dialog-header { cursor:grabbing; }

.contact-dialog-heading {
  display:flex;
  align-items:center;
  gap:8px;
}

.contact-dialog-icon {
  font-size:1.12rem;
  line-height:1;
}

.contact-dialog-body {
  position:relative;
  height:calc(100% - 48px);
  background:#fff;
}

.contact-dialog-loading {
  position:absolute;
  z-index:1;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:24px;
  background:linear-gradient(180deg,#fbfaff 0%,#fff 38%);
  color:#667085;
  font-size:.86rem;
  text-align:center;
  transition:opacity .18s ease,visibility .18s ease;
}

.contact-dialog-body[data-loaded="true"] .contact-dialog-loading {
  visibility:hidden;
  opacity:0;
  pointer-events:none;
}

.contact-dialog-spinner {
  width:18px;
  height:18px;
  flex:0 0 auto;
  border:2px solid #d9ddf7;
  border-top-color:#5b5fe9;
  border-radius:50%;
  animation:contact-dialog-spin .75s linear infinite;
}

@keyframes contact-dialog-spin {
  to { transform:rotate(360deg); }
}

.contact-dialog-close {
  display:grid;
  width:36px;
  height:36px;
  place-items:center;
  padding:0;
  border:0;
  border-radius:9px;
  background:transparent;
  color:#667085;
  font-size:1.5rem;
  line-height:1;
  cursor:pointer;
  touch-action:manipulation;
}

.contact-dialog-close:hover,
.contact-dialog-close:focus-visible {
  background:#f2f4f7;
  color:#172033;
  outline:none;
}

.contact-dialog-frame {
  display:block;
  width:100%;
  height:100%;
  border:0;
  background:#fff;
}

.footer-contact-tools {
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  min-width:0;
}

.footer-contact-tools > p {
  margin:0;
}

.footer-terms-separator {
  display:inline-block;
  margin:0 5px 0 12px;
  color:#98a2b3;
}

.footer-terms-link {
  color:inherit;
  text-decoration:underline;
  text-underline-offset:3px;
}

.footer-terms-link:hover,
.footer-terms-link:focus-visible {
  color:#4338ca;
}

.footer-tools-separator {
  margin:0 4px 0 16px;
  color:#98a2b3;
}

.footer-tools-menu {
  position:relative;
  display:inline-block;
}

.footer-tools-menu summary {
  color:inherit;
  cursor:pointer;
  list-style:none;
  text-decoration:underline;
  text-underline-offset:3px;
}

.footer-tools-menu summary::-webkit-details-marker { display:none; }
.footer-tools-menu summary::marker { content:""; }

.footer-tools-popover {
  position:absolute;
  z-index:40;
  bottom:calc(100% + 10px);
  left:0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:6px 0;
  width:300px;
  padding:8px 10px;
  border:1px solid #d7dee9;
  border-radius:12px;
  background:#fff;
  box-shadow:0 10px 28px rgba(16,24,40,.14);
}

.footer-tools-divider {
  grid-column:1 / -1;
  height:1px;
  background:#edf1f5;
}

.footer-tools-link,
.footer-tools-pending {
  position:relative;
  display:flex;
  align-items:center;
  min-height:32px;
  padding:5px 8px 5px 19px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:#475467;
  font:inherit;
  font-size:.75rem;
  line-height:1.3;
  text-align:left;
  text-decoration:none;
}

.footer-tools-link::before,
.footer-tools-pending::before {
  position:absolute;
  left:8px;
  content:"·";
  color:#98a2b3;
}

.site-footer .footer-tools-link,
.game-footer .footer-tools-link {
  cursor:pointer;
  text-decoration:none;
}

.footer-tools-link:hover,
.footer-tools-link:focus-visible {
  border-color:#cbd5e1;
  background:#f8fafc;
  color:#1d4ed8;
  outline:none;
  transform:translateY(-1px);
}

.footer-tools-pending { cursor:default; }
.footer-tools-pending:focus { outline:none; }

.footer-tools-tooltip {
  position:absolute;
  z-index:1;
  bottom:calc(100% + 6px);
  left:50%;
  width:max-content;
  max-width:160px;
  padding:5px 7px;
  border-radius:6px;
  background:#344054;
  color:#fff;
  font-size:.69rem;
  line-height:1.25;
  opacity:0;
  pointer-events:none;
  transform:translate(-50%,2px);
  transition:opacity .15s ease,transform .15s ease;
}

.footer-tools-pending:hover .footer-tools-tooltip,
.footer-tools-pending:focus .footer-tools-tooltip {
  opacity:1;
  transform:translate(-50%,0);
}

.catalog-shell.catalog-shell:has(> .site-footer),
.landing-shell.landing-shell:has(> .site-footer) {
  padding-top:22px !important;
  padding-bottom:0 !important;
}

@media (max-width:420px) {
  .contact-dialog {
    width:calc(100vw - 16px);
    height:calc(100dvh - 16px);
    border-radius:13px;
  }

  .contact-dialog-header {
    cursor:default;
    touch-action:auto;
  }

  .game-footer,
  .site-footer {
    display:block;
  }

  .game-footer p + p,
  .site-footer p + p {
    margin-top:4px;
  }
}
