.ime-hint-anchor {
    position: relative;
    display: flex;
    align-items: center;
}

#ime-hint-dialog {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 10000;
    width: 280px;
}

.ime-hint-dialog-content {
    background: #f6f6f6;
    border: 2px solid #fff;
    border-radius: 18px;
    padding: 14px 14px 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
}

.ime-hint-dialog-tip {
    position: absolute;
    top: -11px;
    right: 18px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-bottom: 10px solid #fff;
}

.ime-hint-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px;
}

.ime-hint-head > i {
    margin-top: 2px;
    font-size: 18px;
    color: #d99b33;
}

.ime-hint-head strong {
    display: block;
    font-size: 14px;
    color: #333;
}

.ime-hint-head small {
    display: block;
    font-size: 12px;
    color: #777;
}

.ime-hint-field + .ime-hint-field,
.ime-hint-more > .ime-hint-field {
    margin-top: 12px;
}

/* Label left, control right. */
.ime-hint-field--row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.ime-hint-field--row .ime-hint-label {
    margin-bottom: 0;
}

/* 提示哪種輸入法: one track, the choice is the filled pill (as on the start page). */
.ime-hint-seg {
    display: flex;
    gap: 3px;
    padding: 3px;
    border: 1px solid #d5d5d5;
    border-radius: 11px;
    background: #fff;
}

.ime-hint-seg-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}

.ime-hint-seg-btn:hover:not(.is-active) {
    background: #eef3fb;
}

.ime-hint-seg-btn.is-active {
    background: #365A92;
    color: #fff;
}

.ime-hint-fixed {
    font-size: 13px;
    font-weight: 600;
    color: #333;
}

.ime-hint-label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #333;
}

.ime-hint-switch {
    position: relative;
    width: 44px;
    height: 26px;
    padding: 0;
    border: 1px solid #d5d5d5;
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
}

.ime-hint-switch-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #9aa3b2;
    transition: transform 0.15s ease;
}

.ime-hint-switch.is-on {
    background: #eef3fb;
    border-color: #9eb6de;
}

.ime-hint-switch.is-on .ime-hint-switch-knob {
    transform: translateX(18px);
    background: #365A92;
}

.ime-hint-dropdown {
    position: relative;
}

.ime-hint-dropdown-trigger,
.ime-hint-dropdown-option,
.ime-hint-step {
    font: inherit;
    color: #333;
    background: #fff;
    border: 1px solid #d5d5d5;
    cursor: pointer;
}

.ime-hint-dropdown-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-radius: 10px;
    padding: 8px 10px;
}

.ime-hint-dropdown-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1;
    margin: 0;
    padding: 4px;
    list-style: none;
    background: #fff;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.ime-hint-dropdown-option {
    width: 100%;
    text-align: left;
    border: 0;
    border-radius: 8px;
    padding: 8px 10px;
    background: transparent;
}

.ime-hint-dropdown-option.is-active,
.ime-hint-dropdown-option:hover {
    background: #eef3fb;
}

.ime-hint-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ime-hint-step {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.ime-hint-step-value {
    min-width: 3.5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.ime-hint-stepper.is-locked .ime-hint-step {
    opacity: 0.45;
    cursor: default;
}

.ime-hint-lock-note {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #777;
}

.ime-hint-layers {
    display: flex;
    gap: 6px;
}

.ime-hint-layer {
    flex: 1;
    font: inherit;
    color: #333;
    background: #fff;
    border: 1px solid #d5d5d5;
    border-radius: 10px;
    padding: 8px 0;
    cursor: pointer;
}

.ime-hint-layer.is-on {
    background: #eef3fb;
    border-color: #9eb6de;
}

.ime-hint-warning {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #a15c12;
}

.typing-word-tooltip-overlay.typing-word-tooltip-overlay--ime-hint {
    width: auto;
    height: auto;
}

.typing-word-tooltip-overlay--ime-hint .typing-word-tooltip-shell {
    width: auto;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.typing-word-tooltip-overlay--ime-hint .typing-word-tooltip-image {
    width: 74px;
    height: 74px;
    flex: none;
}

/* Both 字碼 and 字根 add a second line. Shrink the glyph by that line so the bubble stays glyph + one line. */
.typing-word-tooltip-overlay--ime-hint.typing-word-tooltip-overlay--ime-hint-compact .typing-word-tooltip-image {
    width: 58px;
    height: 58px;
}

.typing-word-tooltip-overlay--ime-hint .typing-word-tooltip-image.is-off,
.ime-hint-bubble-codes.is-off {
    display: none;
}

.ime-hint-bubble-codes {
    display: flex;
    gap: 8px;
}

.ime-hint-bubble-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 1em;
}

.ime-hint-bubble-letter,
.ime-hint-bubble-radical {
    font-size: 14px;
    line-height: 1.15;
    color: #333;
    font-family: "Roboto Mono", "Microsoft YaHei", "PingFang SC", sans-serif;
}

.ime-hint-bubble-word {
    font-family: "Roboto Mono", monospace;
    font-size: 22px;
    line-height: 1.2;
    color: #333;
    white-space: nowrap;
}

.typing-word-tooltip-overlay--ime-hint.font-size-small .ime-hint-bubble-word {
    font-size: 16px;
}

.typing-word-tooltip-overlay--ime-hint.font-size-normal .ime-hint-bubble-word {
    font-size: 22px;
}

.typing-word-tooltip-overlay--ime-hint.font-size-large .ime-hint-bubble-word {
    font-size: 36px;
}

.ime-hint-bubble-word.is-off {
    display: none;
}

body.fcj-dark .ime-hint-dialog-content {
    background: #232834;
    border-color: #343c4b;
    color: #dde2ea;
}

body.fcj-dark .ime-hint-dialog-tip {
    border-bottom-color: #343c4b;
}

body.fcj-dark .ime-hint-label,
body.fcj-dark .ime-hint-step-value {
    color: #dde2ea;
}

body.fcj-dark .ime-hint-switch,
body.fcj-dark .ime-hint-dropdown-trigger,
body.fcj-dark .ime-hint-dropdown-menu,
body.fcj-dark .ime-hint-step {
    background: #1d222b;
    color: #dde2ea;
    border-color: #343c4b;
}

body.fcj-dark .ime-hint-dropdown-option {
    color: #dde2ea;
}

body.fcj-dark .ime-hint-dropdown-option.is-active,
body.fcj-dark .ime-hint-dropdown-option:hover {
    background: #2a3344;
}

body.fcj-dark .ime-hint-switch.is-on {
    background: #2a3344;
    border-color: #4d6288;
}

body.fcj-dark .ime-hint-switch.is-on .ime-hint-switch-knob {
    background: #8eafdf;
}

body.fcj-dark .ime-hint-layer {
    background: #1d222b;
    color: #dde2ea;
    border-color: #343c4b;
}

body.fcj-dark .ime-hint-layer.is-on {
    background: #2a3344;
    border-color: #4d6288;
}

body.fcj-dark .ime-hint-warning {
    color: #e0b15a;
}

body.fcj-dark .ime-hint-lock-note {
    color: #9aa3b2;
}
